@hotmeshio/hotmesh 0.1.12 → 0.1.14

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1827,6 +1827,8 @@ const getWorkflowYAML = (app, version) => {
1827
1827
  type: number
1828
1828
  expire:
1829
1829
  type: number
1830
+ signalIn:
1831
+ type: boolean
1830
1832
  parentWorkflowId:
1831
1833
  type: string
1832
1834
  description: used to forge the cleanup key
@@ -1861,6 +1863,16 @@ const getWorkflowYAML = (app, version) => {
1861
1863
  - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1862
1864
  - ['{@array.get}', originJobId]
1863
1865
  - ['{@object.get}']
1866
+ expire:
1867
+ '@pipe':
1868
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1869
+ - ['{@array.get}', expire]
1870
+ - ['{@object.get}']
1871
+ signalIn:
1872
+ '@pipe':
1873
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1874
+ - ['{@array.get}', signalIn]
1875
+ - ['{@object.get}']
1864
1876
  parentWorkflowId:
1865
1877
  '@pipe':
1866
1878
  - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
@@ -2024,6 +2036,8 @@ const getWorkflowYAML = (app, version) => {
2024
2036
  description: the arguments to pass to the activity
2025
2037
  items:
2026
2038
  type: string
2039
+ expire:
2040
+ type: number
2027
2041
  backoffCoefficient:
2028
2042
  type: number
2029
2043
  maximumAttempts:
@@ -2071,9 +2085,26 @@ const getWorkflowYAML = (app, version) => {
2071
2085
  - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2072
2086
  - ['{@array.get}', workflowTopic]
2073
2087
  - ['{@object.get}']
2074
- backoffCoefficient: '{collator_trigger.output.data.backoffCoefficient}'
2075
- maximumAttempts: '{collator_trigger.output.data.maximumAttempts}'
2076
- maximumInterval: '{collator_trigger.output.data.maximumInterval}'
2088
+ expire:
2089
+ '@pipe':
2090
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2091
+ - ['{@array.get}', expire]
2092
+ - ['{@object.get}']
2093
+ backoffCoefficient:
2094
+ '@pipe':
2095
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2096
+ - ['{@array.get}', backoffCoefficient]
2097
+ - ['{@object.get}']
2098
+ maximumAttempts:
2099
+ '@pipe':
2100
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2101
+ - ['{@array.get}', maximumAttempts]
2102
+ - ['{@object.get}']
2103
+ maximumInterval:
2104
+ '@pipe':
2105
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2106
+ - ['{@array.get}', maximumInterval]
2107
+ - ['{@object.get}']
2077
2108
  output:
2078
2109
  schema:
2079
2110
  type: object
@@ -48,6 +48,12 @@ declare class EngineService {
48
48
  initSubChannel(sub: RedisClient): Promise<void>;
49
49
  initStreamChannel(stream: RedisClient): Promise<void>;
50
50
  initRouter(config: HotMeshConfig): Promise<Router>;
51
+ /**
52
+ * resolves the distributed executable version using a delay
53
+ * to allow deployment race conditions to resolve
54
+ * @private
55
+ */
56
+ fetchAndVerifyVID(vid: AppVID, count?: number): Promise<AppVID>;
51
57
  getVID(vid?: AppVID): Promise<AppVID>;
52
58
  setCacheMode(cacheMode: CacheMode, untilVersion: string): void;
53
59
  routeToSubscribers(topic: string, message: JobOutput): Promise<void>;
@@ -94,6 +94,30 @@ class EngineService {
94
94
  throttle,
95
95
  }, this.stream, this.store, this.logger);
96
96
  }
97
+ /**
98
+ * resolves the distributed executable version using a delay
99
+ * to allow deployment race conditions to resolve
100
+ * @private
101
+ */
102
+ async fetchAndVerifyVID(vid, count = 0) {
103
+ if (isNaN(Number(vid.version))) {
104
+ const app = await this.store.getApp(vid.id, true);
105
+ if (!isNaN(Number(app.version))) {
106
+ if (!this.apps)
107
+ this.apps = {};
108
+ this.apps[vid.id] = app;
109
+ return { id: vid.id, version: app.version };
110
+ }
111
+ else if (count < 10) {
112
+ await (0, utils_1.sleepFor)(enums_1.HMSH_QUORUM_DELAY_MS * 2);
113
+ return await this.fetchAndVerifyVID(vid, count + 1);
114
+ }
115
+ else {
116
+ this.logger.error('engine-vid-resolution-error', { id: vid.id, guid: this.guid });
117
+ }
118
+ }
119
+ return vid;
120
+ }
97
121
  async getVID(vid) {
98
122
  if (this.cacheMode === 'nocache') {
99
123
  const app = await this.store.getApp(this.appId, true);
@@ -112,7 +136,10 @@ class EngineService {
112
136
  return vid;
113
137
  }
114
138
  else {
115
- return { id: this.appId, version: this.apps?.[this.appId].version };
139
+ return await this.fetchAndVerifyVID({
140
+ id: this.appId,
141
+ version: this.apps?.[this.appId].version
142
+ });
116
143
  }
117
144
  }
118
145
  setCacheMode(cacheMode, untilVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",