@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.
@@ -6365,6 +6365,7 @@ var AUTHORITY_QUERY_RESULT_KEYS = {
6365
6365
  signal_registry: "signalRegistrys",
6366
6366
  intent_registry: "intentRegistrys"
6367
6367
  };
6368
+ var EARLY_SYNC_REQUEST_DELAYS_MS = [2e3, 1e4, 3e4];
6368
6369
  function resolveSyncQueryRows(ctx, tableName) {
6369
6370
  const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
6370
6371
  const rows = ctx?.[resultKey];
@@ -6815,6 +6816,24 @@ var GraphSyncController = class _GraphSyncController {
6815
6816
  if (registerTaskTask) {
6816
6817
  this.splitTasksForRegistration.then(registerTaskTask);
6817
6818
  }
6819
+ CadenzaService.createMetaTask(
6820
+ "Prepare created task for immediate sync",
6821
+ (ctx) => {
6822
+ const task = ctx.taskInstance ?? (ctx.data?.name ? CadenzaService.get(String(ctx.data.name)) : void 0);
6823
+ if (!task || task.hidden || !task.register || task.registered) {
6824
+ return false;
6825
+ }
6826
+ return {
6827
+ __syncing: true,
6828
+ tasks: [task]
6829
+ };
6830
+ },
6831
+ "Schedules newly created tasks into the graph sync registration flow without waiting for the next periodic tick.",
6832
+ {
6833
+ register: false,
6834
+ isHidden: true
6835
+ }
6836
+ ).doOn("meta.task.created").then(this.splitTasksForRegistration);
6818
6837
  CadenzaService.createUniqueMetaTask(
6819
6838
  "Gather task registration",
6820
6839
  () => {
@@ -7603,11 +7622,13 @@ var GraphSyncController = class _GraphSyncController {
7603
7622
  ).doOn(...authoritativeRegistrationTriggers).then(authoritativeIntentReconciliationGraph);
7604
7623
  CadenzaService.signalBroker.getSignalsTask.clone().doOn(
7605
7624
  "meta.sync_controller.sync_tick",
7606
- "meta.service_registry.initial_sync_complete"
7625
+ "meta.service_registry.initial_sync_complete",
7626
+ "meta.sync_requested"
7607
7627
  ).then(this.splitSignalsTask);
7608
7628
  CadenzaService.registry.getAllTasks.clone().doOn(
7609
7629
  "meta.sync_controller.sync_tick",
7610
- "meta.sync_controller.synced_signals"
7630
+ "meta.sync_controller.synced_signals",
7631
+ "meta.sync_requested"
7611
7632
  ).then(this.splitTasksForRegistration);
7612
7633
  CadenzaService.createMetaTask("Get all intents", (ctx) => {
7613
7634
  return {
@@ -7616,11 +7637,13 @@ var GraphSyncController = class _GraphSyncController {
7616
7637
  };
7617
7638
  }).doOn(
7618
7639
  "meta.sync_controller.sync_tick",
7619
- "meta.service_registry.initial_sync_complete"
7640
+ "meta.service_registry.initial_sync_complete",
7641
+ "meta.sync_requested"
7620
7642
  ).then(this.splitIntentsTask);
7621
7643
  CadenzaService.registry.getAllRoutines.clone().doOn(
7622
7644
  "meta.sync_controller.sync_tick",
7623
- "meta.service_registry.initial_sync_complete"
7645
+ "meta.service_registry.initial_sync_complete",
7646
+ "meta.sync_requested"
7624
7647
  ).then(this.splitRoutinesTask);
7625
7648
  CadenzaService.createMetaTask("Get all actors", (ctx) => {
7626
7649
  return {
@@ -7629,7 +7652,8 @@ var GraphSyncController = class _GraphSyncController {
7629
7652
  };
7630
7653
  }).doOn(
7631
7654
  "meta.sync_controller.sync_tick",
7632
- "meta.service_registry.initial_sync_complete"
7655
+ "meta.service_registry.initial_sync_complete",
7656
+ "meta.sync_requested"
7633
7657
  ).then(this.splitActorsForRegistration);
7634
7658
  CadenzaService.createMetaTask("Get registered task for task graph sync", (ctx) => {
7635
7659
  const task = ctx.task ?? (ctx.__taskName ? CadenzaService.get(ctx.__taskName) : void 0);
@@ -7646,7 +7670,8 @@ var GraphSyncController = class _GraphSyncController {
7646
7670
  );
7647
7671
  CadenzaService.registry.doForEachTask.clone().doOn(
7648
7672
  "meta.sync_controller.synced_signals",
7649
- "meta.sync_controller.synced_tasks"
7673
+ "meta.sync_controller.synced_tasks",
7674
+ "meta.sync_requested"
7650
7675
  ).then(
7651
7676
  CadenzaService.createMetaTask(
7652
7677
  "Ensure signal and task sync ready",
@@ -7680,7 +7705,8 @@ var GraphSyncController = class _GraphSyncController {
7680
7705
  );
7681
7706
  CadenzaService.registry.doForEachTask.clone().doOn(
7682
7707
  "meta.sync_controller.synced_intents",
7683
- "meta.sync_controller.synced_tasks"
7708
+ "meta.sync_controller.synced_tasks",
7709
+ "meta.sync_requested"
7684
7710
  ).then(
7685
7711
  CadenzaService.createMetaTask(
7686
7712
  "Ensure intent and task sync ready",
@@ -7714,7 +7740,8 @@ var GraphSyncController = class _GraphSyncController {
7714
7740
  );
7715
7741
  CadenzaService.registry.doForEachTask.clone().doOn(
7716
7742
  "meta.sync_controller.synced_actors",
7717
- "meta.sync_controller.synced_tasks"
7743
+ "meta.sync_controller.synced_tasks",
7744
+ "meta.sync_requested"
7718
7745
  ).then(this.registerActorTaskMapTask);
7719
7746
  CadenzaService.createMetaTask("Get registered task for actor sync", (ctx) => {
7720
7747
  const task = ctx.task ?? (ctx.__taskName ? CadenzaService.get(ctx.__taskName) : void 0);
@@ -7739,7 +7766,7 @@ var GraphSyncController = class _GraphSyncController {
7739
7766
  CadenzaService.registry.getAllRoutines.clone().doOn(
7740
7767
  "meta.sync_controller.synced_routines",
7741
7768
  "meta.sync_controller.synced_tasks",
7742
- "meta.sync_controller.task_registered"
7769
+ "meta.sync_requested"
7743
7770
  ).then(
7744
7771
  CadenzaService.createMetaTask(
7745
7772
  "Ensure routine and task sync ready",
@@ -7783,7 +7810,9 @@ var GraphSyncController = class _GraphSyncController {
7783
7810
  { __syncing: true },
7784
7811
  250
7785
7812
  );
7786
- CadenzaService.schedule("meta.sync_requested", { __syncing: true }, 2e3);
7813
+ for (const delayMs of EARLY_SYNC_REQUEST_DELAYS_MS) {
7814
+ CadenzaService.schedule("meta.sync_requested", { __syncing: true }, delayMs);
7815
+ }
7787
7816
  }
7788
7817
  }
7789
7818
  };