@cadenza.io/service 2.0.20 → 2.0.21
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -21950,7 +21950,7 @@ declare class CadenzaService {
|
|
|
21950
21950
|
* ```
|
|
21951
21951
|
*/
|
|
21952
21952
|
static emit(signal: string, data?: AnyObject): void;
|
|
21953
|
-
static debounce(signal: string, context
|
|
21953
|
+
static debounce(signal: string, context?: any, delayMs?: number): void;
|
|
21954
21954
|
/**
|
|
21955
21955
|
* Executes the given task or graph routine within the provided context using the configured runner.
|
|
21956
21956
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -21950,7 +21950,7 @@ declare class CadenzaService {
|
|
|
21950
21950
|
* ```
|
|
21951
21951
|
*/
|
|
21952
21952
|
static emit(signal: string, data?: AnyObject): void;
|
|
21953
|
-
static debounce(signal: string, context
|
|
21953
|
+
static debounce(signal: string, context?: any, delayMs?: number): void;
|
|
21954
21954
|
/**
|
|
21955
21955
|
* Executes the given task or graph routine within the provided context using the configured runner.
|
|
21956
21956
|
*
|
package/dist/index.js
CHANGED
|
@@ -3711,6 +3711,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3711
3711
|
function* (ctx, emit) {
|
|
3712
3712
|
console.log("SPLITTING ROUTINES FOR REGISTRATION");
|
|
3713
3713
|
const { routines } = ctx;
|
|
3714
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3714
3715
|
if (!routines) return;
|
|
3715
3716
|
for (const routine of routines) {
|
|
3716
3717
|
if (routine.registered) continue;
|
|
@@ -3754,7 +3755,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3754
3755
|
}
|
|
3755
3756
|
}
|
|
3756
3757
|
).attachSignal("global.meta.sync_controller.routine_added").then(
|
|
3757
|
-
|
|
3758
|
+
this.isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(
|
|
3758
3759
|
"task_to_routine_map",
|
|
3759
3760
|
{
|
|
3760
3761
|
onConflict: {
|
|
@@ -3771,27 +3772,13 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3771
3772
|
}
|
|
3772
3773
|
},
|
|
3773
3774
|
{ concurrency: 50 }
|
|
3774
|
-
) : CadenzaService.get("dbInsertTaskToRoutineMap")
|
|
3775
|
-
CadenzaService.createUniqueMetaTask("Finish sync", (ctx, emit) => {
|
|
3776
|
-
emit("global.meta.sync_controller.synced", {
|
|
3777
|
-
data: {
|
|
3778
|
-
is_active: true,
|
|
3779
|
-
is_non_responsive: false,
|
|
3780
|
-
is_blocked: false,
|
|
3781
|
-
last_active: formatTimestamp(Date.now())
|
|
3782
|
-
},
|
|
3783
|
-
filter: {
|
|
3784
|
-
uuid: CadenzaService.serviceRegistry.serviceInstanceId
|
|
3785
|
-
}
|
|
3786
|
-
});
|
|
3787
|
-
CadenzaService.log("Synced resources...");
|
|
3788
|
-
}).attachSignal("global.meta.sync_controller.synced")
|
|
3789
|
-
)
|
|
3775
|
+
) : CadenzaService.get("dbInsertTaskToRoutineMap")
|
|
3790
3776
|
);
|
|
3791
3777
|
this.splitSignalsTask = CadenzaService.createMetaTask(
|
|
3792
3778
|
"Split signals for registration",
|
|
3793
3779
|
function* (ctx) {
|
|
3794
3780
|
console.log("Splitting signals for registration...");
|
|
3781
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3795
3782
|
const { signals } = ctx;
|
|
3796
3783
|
if (!signals) return;
|
|
3797
3784
|
const filteredSignals = signals.filter(
|
|
@@ -3829,7 +3816,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3829
3816
|
if (!ctx.__syncing) {
|
|
3830
3817
|
return;
|
|
3831
3818
|
}
|
|
3832
|
-
console.log("REGISTERING SIGNAL", ctx.
|
|
3819
|
+
console.log("REGISTERING SIGNAL", ctx.signalRegistry?.name);
|
|
3820
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3833
3821
|
return { signalName: ctx.signalRegistry?.name };
|
|
3834
3822
|
}).then(CadenzaService.broker.registerSignalTask)
|
|
3835
3823
|
)
|
|
@@ -3838,6 +3826,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3838
3826
|
"Split tasks for registration",
|
|
3839
3827
|
function* (ctx) {
|
|
3840
3828
|
console.log("SPLITTING TASKS FOR REGISTRATION");
|
|
3829
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3841
3830
|
const tasks = ctx.tasks;
|
|
3842
3831
|
for (const task of tasks) {
|
|
3843
3832
|
if (task.registered) continue;
|
|
@@ -3903,6 +3892,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3903
3892
|
ctx.__name,
|
|
3904
3893
|
!!CadenzaService.get(ctx.__name)
|
|
3905
3894
|
);
|
|
3895
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3906
3896
|
CadenzaService.get(ctx.__name).registered = true;
|
|
3907
3897
|
})
|
|
3908
3898
|
)
|
|
@@ -3968,6 +3958,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
3968
3958
|
"Register task map to DB",
|
|
3969
3959
|
function* (ctx) {
|
|
3970
3960
|
const task = ctx.task;
|
|
3961
|
+
CadenzaService.debounce("sync_controller.synced_resource");
|
|
3971
3962
|
if (task.hidden || !task.register) return;
|
|
3972
3963
|
for (const t of task.nextTasks) {
|
|
3973
3964
|
if (task.taskMapRegistration.has(t.name) || t.hidden || !t.register) {
|
|
@@ -4098,6 +4089,20 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
4098
4089
|
)
|
|
4099
4090
|
)
|
|
4100
4091
|
);
|
|
4092
|
+
CadenzaService.createMetaTask("Finish sync", (ctx, emit) => {
|
|
4093
|
+
emit("global.meta.sync_controller.synced", {
|
|
4094
|
+
data: {
|
|
4095
|
+
is_active: true,
|
|
4096
|
+
is_non_responsive: false,
|
|
4097
|
+
is_blocked: false,
|
|
4098
|
+
last_active: formatTimestamp(Date.now())
|
|
4099
|
+
},
|
|
4100
|
+
filter: {
|
|
4101
|
+
uuid: CadenzaService.serviceRegistry.serviceInstanceId
|
|
4102
|
+
}
|
|
4103
|
+
});
|
|
4104
|
+
CadenzaService.log("Synced resources...");
|
|
4105
|
+
}).attachSignal("global.meta.sync_controller.synced").doOn("sync_controller.synced_resource");
|
|
4101
4106
|
console.log("Sync controller init", this.isCadenzaDBReady);
|
|
4102
4107
|
if (!this.isCadenzaDBReady) {
|
|
4103
4108
|
CadenzaService.throttle(
|
|
@@ -4211,7 +4216,7 @@ var CadenzaService = class {
|
|
|
4211
4216
|
static emit(signal, data = {}) {
|
|
4212
4217
|
this.broker?.emit(signal, data);
|
|
4213
4218
|
}
|
|
4214
|
-
static debounce(signal, context, delayMs = 500) {
|
|
4219
|
+
static debounce(signal, context = {}, delayMs = 500) {
|
|
4215
4220
|
this.broker?.debounce(signal, context, delayMs);
|
|
4216
4221
|
}
|
|
4217
4222
|
/**
|