tardie 0.22.2-rc.262 → 0.22.2
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/package.json +2 -2
- package/src/cloudflare/thread.ts +16 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tardie",
|
|
3
|
-
"version": "0.22.2
|
|
3
|
+
"version": "0.22.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Clavia, Inc.",
|
|
6
6
|
"description": "A durable agent harness. State is a pure function of the log.",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"tardigrade": {
|
|
19
|
-
"sourceTree": "
|
|
19
|
+
"sourceTree": "51defd3cb83af555260546ac69a04a069a47c68f"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"src",
|
package/src/cloudflare/thread.ts
CHANGED
|
@@ -260,25 +260,23 @@ export class ThreadDO extends DurableObject<Env> {
|
|
|
260
260
|
this.kick(host)
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
// kick
|
|
263
|
+
// kick retains each admission's drive through synchronization and releases at rest (tla/ActiveDrive.tla, AdmissionRetained and JoinedWorkDrained).
|
|
264
264
|
private kick(host: CloudflareThreadHost): void {
|
|
265
|
-
if (this.driving
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (!failed && host.work() > 0) this.kick(host)
|
|
281
|
-
})
|
|
265
|
+
if (this.driving === undefined) {
|
|
266
|
+
this.driving = Promise.resolve().then(async () => {
|
|
267
|
+
try {
|
|
268
|
+
do {
|
|
269
|
+
await host.drive()
|
|
270
|
+
await this.synchronizeAlarm(host)
|
|
271
|
+
} while (host.work() > 0)
|
|
272
|
+
} catch (cause) {
|
|
273
|
+
console.error("actor drive failed; the alarm remains armed", cause)
|
|
274
|
+
} finally {
|
|
275
|
+
this.driving = undefined
|
|
276
|
+
}
|
|
277
|
+
})
|
|
278
|
+
}
|
|
279
|
+
retainBackgroundTask(this.ctx, this.backgroundTaskOwner, this.driving)
|
|
282
280
|
}
|
|
283
281
|
|
|
284
282
|
async append(thread: string, event: Event): Promise<boolean> {
|