feat: release Dever 0.1.5 with direct workers and long transactions
This commit is contained in:
1 parent
89629c2197
commit
a900d7e8db
153 files changed
+3676
-3708
No files matched your search
@@ -95,17 +95,22 @@ transaction abort() () {
|
||||
}
|
||||
apply(input: Publish) () {
|
||||
original = model.get(input.article_id)
|
||||
title = port.title(original.title)
|
||||
store(input.article_id, title)
|
||||
}
|
||||
transaction store(article_id: model.id, title: Text) () {
|
||||
original = model.get(article_id)
|
||||
marker = model.create({ title = "started" })
|
||||
article = model.create({ title = port.title(original.title) })
|
||||
article = model.create({ title = title })
|
||||
}
|
||||
count(title: Text) (total: Int) { total = model.count({ where = title == title }) }
|
||||
arm() (id: Id) { id = dever.job.enqueue(job.cleanup, "manual") }
|
||||
clean() () { article = model.create({ title = "cron" }) }
|
||||
transaction arm() (id: Id) { id = dever.job.enqueue(job.cleanup, "manual") }
|
||||
transaction clean() () { article = model.create({ title = "cron" }) }
|
||||
"#,
|
||||
),
|
||||
(
|
||||
"content/article/job.dever",
|
||||
"database default\njob publish(input: app.Publish) () retry(2) timeout(1000) { app.apply(input) }\njob cleanup() () retry(2) timeout(1000) { app.clean() }\nschedule cleanup = \"* * * * *\"",
|
||||
"database default\nlong job publish(input: app.Publish) () retry(2) timeout(1000) { app.apply(input) }\njob cleanup() () retry(2) timeout(1000) { app.clean() }\nschedule cleanup = \"* * * * *\"",
|
||||
),
|
||||
(
|
||||
"content/article/port.dever",
|
||||
@@ -566,8 +571,8 @@ retry() () {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires explicit runtime archive; bounded task cancellation inside owned SQLite transactions"]
|
||||
fn timed_out_job_drains_children_and_rolls_back_before_retry() {
|
||||
#[ignore = "requires explicit runtime archive; bounded cancellation between committed SQLite stages"]
|
||||
fn timed_out_job_drains_children_and_preserves_committed_stages() {
|
||||
use dever_runtime::orm::Value;
|
||||
let module = [
|
||||
("main.dever", "main() () {}"),
|
||||
@@ -577,7 +582,7 @@ retry() () {
|
||||
),
|
||||
(
|
||||
"content/article/app.dever",
|
||||
"submit() (id: Id) { id = dever.job.enqueue(job.publish, \"timeout\") }\napply() () { saved = model.create({ title = \"rollback\" })\n port.pause() }\ncount() (total: Int) { total = model.count() }",
|
||||
"transaction submit() (id: Id) { id = dever.job.enqueue(job.publish, \"timeout\") }\ntransaction save() () { saved = model.create({ title = \"committed\" }) }\napply() () { save()\n port.pause() }\ncount() (total: Int) { total = model.count() }",
|
||||
),
|
||||
(
|
||||
"content/article/port.dever",
|
||||
@@ -586,7 +591,7 @@ retry() () {
|
||||
("content/article/adapter.dever", "port.pause() () {}"),
|
||||
(
|
||||
"content/article/job.dever",
|
||||
"database default\njob publish() () retry(2) timeout(10) { app.apply() }",
|
||||
"database default\nlong job publish() () retry(2) timeout(10) { app.apply() }",
|
||||
),
|
||||
];
|
||||
let tests = [(
|
||||
@@ -595,10 +600,10 @@ retry() () {
|
||||
timeout() () {
|
||||
id = app.submit()
|
||||
assert_eq(dever.test.drain_jobs(5), 1)
|
||||
assert_eq(app.count(), 0)
|
||||
assert_eq(app.count(), 1)
|
||||
dever.test.advance_clock(1000)
|
||||
assert_eq(dever.test.drain_jobs(5), 1)
|
||||
assert_eq(app.count(), 0)
|
||||
assert_eq(app.count(), 2)
|
||||
dever.test.advance_clock(10000)
|
||||
assert_eq(dever.test.drain_jobs(5), 0)
|
||||
}"#,
|
||||
|
||||
Reference in new issue
Block a user