@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.
@@ -6316,6 +6316,7 @@ var AUTHORITY_QUERY_RESULT_KEYS = {
6316
6316
  signal_registry: "signalRegistrys",
6317
6317
  intent_registry: "intentRegistrys"
6318
6318
  };
6319
+ var EARLY_SYNC_REQUEST_DELAYS_MS = [2e3, 1e4, 3e4];
6319
6320
  function resolveSyncQueryRows(ctx, tableName) {
6320
6321
  const resultKey = AUTHORITY_QUERY_RESULT_KEYS[tableName];
6321
6322
  const rows = ctx?.[resultKey];
@@ -6766,6 +6767,24 @@ var GraphSyncController = class _GraphSyncController {
6766
6767
  if (registerTaskTask) {
6767
6768
  this.splitTasksForRegistration.then(registerTaskTask);
6768
6769
  }
6770
+ CadenzaService.createMetaTask(
6771
+ "Prepare created task for immediate sync",
6772
+ (ctx) => {
6773
+ const task = ctx.taskInstance ?? (ctx.data?.name ? CadenzaService.get(String(ctx.data.name)) : void 0);
6774
+ if (!task || task.hidden || !task.register || task.registered) {
6775
+ return false;
6776
+ }
6777
+ return {
6778
+ __syncing: true,
6779
+ tasks: [task]
6780
+ };
6781
+ },
6782
+ "Schedules newly created tasks into the graph sync registration flow without waiting for the next periodic tick.",
6783
+ {
6784
+ register: false,
6785
+ isHidden: true
6786
+ }
6787
+ ).doOn("meta.task.created").then(this.splitTasksForRegistration);
6769
6788
  CadenzaService.createUniqueMetaTask(
6770
6789
  "Gather task registration",
6771
6790
  () => {
@@ -7554,11 +7573,13 @@ var GraphSyncController = class _GraphSyncController {
7554
7573
  ).doOn(...authoritativeRegistrationTriggers).then(authoritativeIntentReconciliationGraph);
7555
7574
  CadenzaService.signalBroker.getSignalsTask.clone().doOn(
7556
7575
  "meta.sync_controller.sync_tick",
7557
- "meta.service_registry.initial_sync_complete"
7576
+ "meta.service_registry.initial_sync_complete",
7577
+ "meta.sync_requested"
7558
7578
  ).then(this.splitSignalsTask);
7559
7579
  CadenzaService.registry.getAllTasks.clone().doOn(
7560
7580
  "meta.sync_controller.sync_tick",
7561
- "meta.sync_controller.synced_signals"
7581
+ "meta.sync_controller.synced_signals",
7582
+ "meta.sync_requested"
7562
7583
  ).then(this.splitTasksForRegistration);
7563
7584
  CadenzaService.createMetaTask("Get all intents", (ctx) => {
7564
7585
  return {
@@ -7567,11 +7588,13 @@ var GraphSyncController = class _GraphSyncController {
7567
7588
  };
7568
7589
  }).doOn(
7569
7590
  "meta.sync_controller.sync_tick",
7570
- "meta.service_registry.initial_sync_complete"
7591
+ "meta.service_registry.initial_sync_complete",
7592
+ "meta.sync_requested"
7571
7593
  ).then(this.splitIntentsTask);
7572
7594
  CadenzaService.registry.getAllRoutines.clone().doOn(
7573
7595
  "meta.sync_controller.sync_tick",
7574
- "meta.service_registry.initial_sync_complete"
7596
+ "meta.service_registry.initial_sync_complete",
7597
+ "meta.sync_requested"
7575
7598
  ).then(this.splitRoutinesTask);
7576
7599
  CadenzaService.createMetaTask("Get all actors", (ctx) => {
7577
7600
  return {
@@ -7580,7 +7603,8 @@ var GraphSyncController = class _GraphSyncController {
7580
7603
  };
7581
7604
  }).doOn(
7582
7605
  "meta.sync_controller.sync_tick",
7583
- "meta.service_registry.initial_sync_complete"
7606
+ "meta.service_registry.initial_sync_complete",
7607
+ "meta.sync_requested"
7584
7608
  ).then(this.splitActorsForRegistration);
7585
7609
  CadenzaService.createMetaTask("Get registered task for task graph sync", (ctx) => {
7586
7610
  const task = ctx.task ?? (ctx.__taskName ? CadenzaService.get(ctx.__taskName) : void 0);
@@ -7597,7 +7621,8 @@ var GraphSyncController = class _GraphSyncController {
7597
7621
  );
7598
7622
  CadenzaService.registry.doForEachTask.clone().doOn(
7599
7623
  "meta.sync_controller.synced_signals",
7600
- "meta.sync_controller.synced_tasks"
7624
+ "meta.sync_controller.synced_tasks",
7625
+ "meta.sync_requested"
7601
7626
  ).then(
7602
7627
  CadenzaService.createMetaTask(
7603
7628
  "Ensure signal and task sync ready",
@@ -7631,7 +7656,8 @@ var GraphSyncController = class _GraphSyncController {
7631
7656
  );
7632
7657
  CadenzaService.registry.doForEachTask.clone().doOn(
7633
7658
  "meta.sync_controller.synced_intents",
7634
- "meta.sync_controller.synced_tasks"
7659
+ "meta.sync_controller.synced_tasks",
7660
+ "meta.sync_requested"
7635
7661
  ).then(
7636
7662
  CadenzaService.createMetaTask(
7637
7663
  "Ensure intent and task sync ready",
@@ -7665,7 +7691,8 @@ var GraphSyncController = class _GraphSyncController {
7665
7691
  );
7666
7692
  CadenzaService.registry.doForEachTask.clone().doOn(
7667
7693
  "meta.sync_controller.synced_actors",
7668
- "meta.sync_controller.synced_tasks"
7694
+ "meta.sync_controller.synced_tasks",
7695
+ "meta.sync_requested"
7669
7696
  ).then(this.registerActorTaskMapTask);
7670
7697
  CadenzaService.createMetaTask("Get registered task for actor sync", (ctx) => {
7671
7698
  const task = ctx.task ?? (ctx.__taskName ? CadenzaService.get(ctx.__taskName) : void 0);
@@ -7690,7 +7717,7 @@ var GraphSyncController = class _GraphSyncController {
7690
7717
  CadenzaService.registry.getAllRoutines.clone().doOn(
7691
7718
  "meta.sync_controller.synced_routines",
7692
7719
  "meta.sync_controller.synced_tasks",
7693
- "meta.sync_controller.task_registered"
7720
+ "meta.sync_requested"
7694
7721
  ).then(
7695
7722
  CadenzaService.createMetaTask(
7696
7723
  "Ensure routine and task sync ready",
@@ -7734,7 +7761,9 @@ var GraphSyncController = class _GraphSyncController {
7734
7761
  { __syncing: true },
7735
7762
  250
7736
7763
  );
7737
- CadenzaService.schedule("meta.sync_requested", { __syncing: true }, 2e3);
7764
+ for (const delayMs of EARLY_SYNC_REQUEST_DELAYS_MS) {
7765
+ CadenzaService.schedule("meta.sync_requested", { __syncing: true }, delayMs);
7766
+ }
7738
7767
  }
7739
7768
  }
7740
7769
  };