@opengeni/worker-bundle 0.26.0-canary.1 → 0.26.0-canary.3
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/{activities-control-KS3ZPQVY.js → activities-control-SHMDOQWS.js} +40 -3
- package/dist/{activities-control-KS3ZPQVY.js.map → activities-control-SHMDOQWS.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +17 -17
- package/src/activities/session-state.ts +5 -6
- package/src/activities/workflow-wake.ts +36 -0
|
@@ -9792,7 +9792,8 @@ function createSessionStateActivities(services, overrides = {}) {
|
|
|
9792
9792
|
sessionId: input.sessionId,
|
|
9793
9793
|
workflowId,
|
|
9794
9794
|
trigger: input.trigger,
|
|
9795
|
-
error: input.error ?? "Agent turn admission failed before attempt claim."
|
|
9795
|
+
error: input.error ?? "Agent turn admission failed before attempt claim.",
|
|
9796
|
+
...input.preClaimFailure ? { admissionFailure: input.preClaimFailure } : {}
|
|
9796
9797
|
});
|
|
9797
9798
|
if (failed.action === "terminal") return { action: "terminal" };
|
|
9798
9799
|
if (failed.action === "stale") return { action: "stale" };
|
|
@@ -10089,7 +10090,7 @@ function createSessionStateActivities(services, overrides = {}) {
|
|
|
10089
10090
|
await publishDurableSessionEventsFn(bus, input.workspaceId, input.sessionId, settled.events);
|
|
10090
10091
|
}
|
|
10091
10092
|
await refreshQueuedTurnsGauge(db, observability, countQueuedTurnsFn, recordTurnsQueuedGaugeFn);
|
|
10092
|
-
if (settled.action === "stale") {
|
|
10093
|
+
if (settled.action === "stale" || !settled.notifyParent) {
|
|
10093
10094
|
return;
|
|
10094
10095
|
}
|
|
10095
10096
|
await notifyParentOfChildIdleFn(
|
|
@@ -10121,6 +10122,13 @@ async function refreshQueuedTurnsGauge(db, observability, countQueuedTurnsFn, re
|
|
|
10121
10122
|
}
|
|
10122
10123
|
|
|
10123
10124
|
// src/activities/workflow-wake.ts
|
|
10125
|
+
import {
|
|
10126
|
+
fireWorkspacePauseTimerInTransaction,
|
|
10127
|
+
listDueWorkspacePauseTimers,
|
|
10128
|
+
withWorkspaceRls,
|
|
10129
|
+
getWorkspaceControlEvent
|
|
10130
|
+
} from "@opengeni/db";
|
|
10131
|
+
import { publishDurableWorkspaceControlEvent } from "@opengeni/events";
|
|
10124
10132
|
var BATCH_SIZE = 1e3;
|
|
10125
10133
|
var MAX_DELIVERIES_PER_ACTIVITY = 1e4;
|
|
10126
10134
|
var MAX_TITLE_FANOUT_PER_ACTIVITY = 1e3;
|
|
@@ -10128,6 +10136,35 @@ function createWorkflowWakeActivities(services) {
|
|
|
10128
10136
|
return {
|
|
10129
10137
|
async dispatchSessionWorkflowWakes() {
|
|
10130
10138
|
const service = await services();
|
|
10139
|
+
const timers = await listDueWorkspacePauseTimers(service.db, 100);
|
|
10140
|
+
for (const timer of timers) {
|
|
10141
|
+
try {
|
|
10142
|
+
const result = await withWorkspaceRls(
|
|
10143
|
+
service.db,
|
|
10144
|
+
timer.workspace_id,
|
|
10145
|
+
(scoped) => scoped.transaction(
|
|
10146
|
+
(tx) => fireWorkspacePauseTimerInTransaction(tx, {
|
|
10147
|
+
workspaceId: timer.workspace_id,
|
|
10148
|
+
timerId: timer.timer_id
|
|
10149
|
+
})
|
|
10150
|
+
)
|
|
10151
|
+
);
|
|
10152
|
+
if (result?.workspaceControlEventId) {
|
|
10153
|
+
const event = await getWorkspaceControlEvent(
|
|
10154
|
+
service.db,
|
|
10155
|
+
timer.workspace_id,
|
|
10156
|
+
result.workspaceControlEventId
|
|
10157
|
+
);
|
|
10158
|
+
if (event)
|
|
10159
|
+
await publishDurableWorkspaceControlEvent(service.bus, timer.workspace_id, event);
|
|
10160
|
+
}
|
|
10161
|
+
} catch (error) {
|
|
10162
|
+
service.observability.warn("Workspace pause timer will retry", {
|
|
10163
|
+
workspaceId: timer.workspace_id,
|
|
10164
|
+
error: String(error)
|
|
10165
|
+
});
|
|
10166
|
+
}
|
|
10167
|
+
}
|
|
10131
10168
|
let claimed = 0;
|
|
10132
10169
|
let delivered = 0;
|
|
10133
10170
|
let failed = 0;
|
|
@@ -10199,4 +10236,4 @@ export {
|
|
|
10199
10236
|
createControlActivities,
|
|
10200
10237
|
createControlActivitiesFromServices
|
|
10201
10238
|
};
|
|
10202
|
-
//# sourceMappingURL=activities-control-
|
|
10239
|
+
//# sourceMappingURL=activities-control-SHMDOQWS.js.map
|