bulltrackers-module 1.0.309 → 1.0.310

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  # Cloud Workflows: Precision Cursor-Based Orchestrator
2
2
  # PURPOSE: Orchestrates 5 passes with dynamic date detection and cursor logic.
3
+ # UPDATED: Added Short-Circuit logic to break infinite loops on empty dispatches.
3
4
 
4
5
  main:
5
6
  params: [input]
@@ -26,6 +27,7 @@ main:
26
27
  assign:
27
28
  - n_cursor: 1
28
29
  - pass_complete: false
30
+ - consecutive_empty_dispatches: 0 # Track consecutive "duds" to prevent infinite loops
29
31
 
30
32
  - sequential_date_loop:
31
33
  switch:
@@ -49,9 +51,12 @@ main:
49
51
  assign:
50
52
  - pass_complete: true
51
53
 
52
- # State 2: Tasks were dispatched
54
+ # State 2: Tasks were dispatched (Healthy State)
53
55
  - condition: '${dispatch_res.body.dispatched > 0}'
54
56
  steps:
57
+ - reset_retry_counter:
58
+ assign:
59
+ - consecutive_empty_dispatches: 0 # Reset counter because progress was made
55
60
  - log_dispatch:
56
61
  call: sys.log
57
62
  args:
@@ -64,8 +69,45 @@ main:
64
69
  assign:
65
70
  # If n_cursor_ignored is true, stay on same N to retry (e.g. for high-mem)
66
71
  - n_cursor: '${if(dispatch_res.body.n_cursor_ignored, n_cursor, n_cursor + 1)}'
67
- - next_loop:
72
+ - next_loop_work:
68
73
  next: sequential_date_loop
69
74
 
75
+ # State 3: No tasks dispatched (Potential Infinite Loop Scenario)
76
+ # The Dispatcher is "Continuing" but found nothing runnable on the target date.
77
+ - condition: '${dispatch_res.body.dispatched == 0}'
78
+ steps:
79
+ - increment_retry:
80
+ assign:
81
+ - consecutive_empty_dispatches: '${consecutive_empty_dispatches + 1}'
82
+ - check_break_condition:
83
+ switch:
84
+ # If we have tried 3 times in a row with 0 results, assume the date is "stuck"
85
+ - condition: '${consecutive_empty_dispatches >= 3}'
86
+ steps:
87
+ - log_break:
88
+ call: sys.log
89
+ args:
90
+ text: '${"Pass " + pass_id + " - 🛑 FORCE BREAK: 3 consecutive empty dispatches. Moving to next pass to prevent infinite loop."}'
91
+ - force_complete:
92
+ assign:
93
+ - pass_complete: true
94
+ # Otherwise, wait briefly and retry (or move cursor depending on dispatcher logic)
95
+ - condition: '${true}'
96
+ steps:
97
+ - log_retry:
98
+ call: sys.log
99
+ args:
100
+ text: '${"Pass " + pass_id + " - Empty dispatch (" + string(consecutive_empty_dispatches) + "/3). Retrying..."}'
101
+ - wait_short:
102
+ call: sys.sleep
103
+ args:
104
+ seconds: 5
105
+ - update_cursor_retry:
106
+ assign:
107
+ # Still advance cursor if it wasn't a strict reroute, to try next date
108
+ - n_cursor: '${if(dispatch_res.body.n_cursor_ignored, n_cursor, n_cursor + 1)}'
109
+ - next_loop_retry:
110
+ next: sequential_date_loop
111
+
70
112
  - finish:
71
113
  return: "Pipeline Execution Satiated and Complete"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.309",
3
+ "version": "1.0.310",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [