Commit 2bfe262
authored
Prevent attempting to suspend multiple times in the same run (#82)
The durable sql itself already checks that a task is currnetly
running when we try to suspend it, which makes it
very difficult to write tests for. However, checking in the durable sql
is insufficient, since we might have an execution that looks like:
* Tokio task A - calls `await_event("foo")`, and doesn't propagate
the `ControlFlow::Suspend` error.
* Tokio task B (possibly in another process) - calls `emit_event("foo")`
* Tokio task C - picks up the now-ready task that was previously
suspended
* Tokio task A - calls `await_event("bar")`, which succeeds, since
the task is now running.
By adding a check rust-side, we can be sure that we catch incorrect
usage of durable1 parent 1eb6aea commit 2bfe262
3 files changed
Lines changed: 60 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
72 | 91 | | |
73 | 92 | | |
74 | 93 | | |
| |||
85 | 104 | | |
86 | 105 | | |
87 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
88 | 117 | | |
89 | 118 | | |
90 | 119 | | |
| |||
128 | 157 | | |
129 | 158 | | |
130 | 159 | | |
| 160 | + | |
131 | 161 | | |
132 | 162 | | |
133 | 163 | | |
| |||
335 | 365 | | |
336 | 366 | | |
337 | 367 | | |
338 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
339 | 371 | | |
340 | 372 | | |
341 | 373 | | |
| |||
414 | 446 | | |
415 | 447 | | |
416 | 448 | | |
417 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
418 | 452 | | |
419 | 453 | | |
420 | 454 | | |
| |||
768 | 802 | | |
769 | 803 | | |
770 | 804 | | |
771 | | - | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
772 | 808 | | |
773 | 809 | | |
774 | 810 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | | - | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
30 | 49 | | |
31 | 50 | | |
32 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | | - | |
| 484 | + | |
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| |||
0 commit comments