@cadenza.io/service 2.17.45 → 2.17.47

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.
package/dist/index.js CHANGED
@@ -8829,6 +8829,7 @@ var AUTHORITY_QUERY_RESULT_KEYS = {
8829
8829
  signal_registry: "signalRegistrys",
8830
8830
  intent_registry: "intentRegistrys"
8831
8831
  };
8832
+ var EARLY_SYNC_REQUEST_DELAYS_MS = [2e3, 1e4, 3e4];
8832
8833
  function resolveSyncQueryRows(ctx, tableName) {
8833
8834
  const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
8834
8835
  const rows = ctx?.[resultKey];
@@ -9279,6 +9280,24 @@ var GraphSyncController = class _GraphSyncController {
9279
9280
  if (registerTaskTask) {
9280
9281
  this.splitTasksForRegistration.then(registerTaskTask);
9281
9282
  }
9283
+ CadenzaService.createMetaTask(
9284
+ "Prepare created task for immediate sync",
9285
+ (ctx) => {
9286
+ const task = ctx.taskInstance ?? (ctx.data?.name ? CadenzaService.get(String(ctx.data.name)) : void 0);
9287
+ if (!task || task.hidden || !task.register || task.registered) {
9288
+ return false;
9289
+ }
9290
+ return {
9291
+ __syncing: true,
9292
+ tasks: [task]
9293
+ };
9294
+ },
9295
+ "Schedules newly created tasks into the graph sync registration flow without waiting for the next periodic tick.",
9296
+ {
9297
+ register: false,
9298
+ isHidden: true
9299
+ }
9300
+ ).doOn("meta.task.created").then(this.splitTasksForRegistration);
9282
9301
  CadenzaService.createUniqueMetaTask(
9283
9302
  "Gather task registration",
9284
9303
  () => {
@@ -10067,11 +10086,13 @@ var GraphSyncController = class _GraphSyncController {
10067
10086
  ).doOn(...authoritativeRegistrationTriggers).then(authoritativeIntentReconciliationGraph);
10068
10087
  CadenzaService.signalBroker.getSignalsTask.clone().doOn(
10069
10088
  "meta.sync_controller.sync_tick",
10070
- "meta.service_registry.initial_sync_complete"
10089
+ "meta.service_registry.initial_sync_complete",
10090
+ "meta.sync_requested"
10071
10091
  ).then(this.splitSignalsTask);
10072
10092
  CadenzaService.registry.getAllTasks.clone().doOn(
10073
10093
  "meta.sync_controller.sync_tick",
10074
- "meta.sync_controller.synced_signals"
10094
+ "meta.sync_controller.synced_signals",
10095
+ "meta.sync_requested"
10075
10096
  ).then(this.splitTasksForRegistration);
10076
10097
  CadenzaService.createMetaTask("Get all intents", (ctx) => {
10077
10098
  return {
@@ -10080,11 +10101,13 @@ var GraphSyncController = class _GraphSyncController {
10080
10101
  };
10081
10102
  }).doOn(
10082
10103
  "meta.sync_controller.sync_tick",
10083
- "meta.service_registry.initial_sync_complete"
10104
+ "meta.service_registry.initial_sync_complete",
10105
+ "meta.sync_requested"
10084
10106
  ).then(this.splitIntentsTask);
10085
10107
  CadenzaService.registry.getAllRoutines.clone().doOn(
10086
10108
  "meta.sync_controller.sync_tick",
10087
- "meta.service_registry.initial_sync_complete"
10109
+ "meta.service_registry.initial_sync_complete",
10110
+ "meta.sync_requested"
10088
10111
  ).then(this.splitRoutinesTask);
10089
10112
  CadenzaService.createMetaTask("Get all actors", (ctx) => {
10090
10113
  return {
@@ -10093,7 +10116,8 @@ var GraphSyncController = class _GraphSyncController {
10093
10116
  };
10094
10117
  }).doOn(
10095
10118
  "meta.sync_controller.sync_tick",
10096
- "meta.service_registry.initial_sync_complete"
10119
+ "meta.service_registry.initial_sync_complete",
10120
+ "meta.sync_requested"
10097
10121
  ).then(this.splitActorsForRegistration);
10098
10122
  CadenzaService.createMetaTask("Get registered task for task graph sync", (ctx) => {
10099
10123
  const task = ctx.task ?? (ctx.__taskName ? CadenzaService.get(ctx.__taskName) : void 0);
@@ -10110,7 +10134,8 @@ var GraphSyncController = class _GraphSyncController {
10110
10134
  );
10111
10135
  CadenzaService.registry.doForEachTask.clone().doOn(
10112
10136
  "meta.sync_controller.synced_signals",
10113
- "meta.sync_controller.synced_tasks"
10137
+ "meta.sync_controller.synced_tasks",
10138
+ "meta.sync_requested"
10114
10139
  ).then(
10115
10140
  CadenzaService.createMetaTask(
10116
10141
  "Ensure signal and task sync ready",
@@ -10144,7 +10169,8 @@ var GraphSyncController = class _GraphSyncController {
10144
10169
  );
10145
10170
  CadenzaService.registry.doForEachTask.clone().doOn(
10146
10171
  "meta.sync_controller.synced_intents",
10147
- "meta.sync_controller.synced_tasks"
10172
+ "meta.sync_controller.synced_tasks",
10173
+ "meta.sync_requested"
10148
10174
  ).then(
10149
10175
  CadenzaService.createMetaTask(
10150
10176
  "Ensure intent and task sync ready",
@@ -10178,7 +10204,8 @@ var GraphSyncController = class _GraphSyncController {
10178
10204
  );
10179
10205
  CadenzaService.registry.doForEachTask.clone().doOn(
10180
10206
  "meta.sync_controller.synced_actors",
10181
- "meta.sync_controller.synced_tasks"
10207
+ "meta.sync_controller.synced_tasks",
10208
+ "meta.sync_requested"
10182
10209
  ).then(this.registerActorTaskMapTask);
10183
10210
  CadenzaService.createMetaTask("Get registered task for actor sync", (ctx) => {
10184
10211
  const task = ctx.task ?? (ctx.__taskName ? CadenzaService.get(ctx.__taskName) : void 0);
@@ -10203,7 +10230,7 @@ var GraphSyncController = class _GraphSyncController {
10203
10230
  CadenzaService.registry.getAllRoutines.clone().doOn(
10204
10231
  "meta.sync_controller.synced_routines",
10205
10232
  "meta.sync_controller.synced_tasks",
10206
- "meta.sync_controller.task_registered"
10233
+ "meta.sync_requested"
10207
10234
  ).then(
10208
10235
  CadenzaService.createMetaTask(
10209
10236
  "Ensure routine and task sync ready",
@@ -10247,7 +10274,9 @@ var GraphSyncController = class _GraphSyncController {
10247
10274
  { __syncing: true },
10248
10275
  250
10249
10276
  );
10250
- CadenzaService.schedule("meta.sync_requested", { __syncing: true }, 2e3);
10277
+ for (const delayMs of EARLY_SYNC_REQUEST_DELAYS_MS) {
10278
+ CadenzaService.schedule("meta.sync_requested", { __syncing: true }, delayMs);
10279
+ }
10251
10280
  }
10252
10281
  }
10253
10282
  };