Commit b4c5b0f
committed
State mach: fix: delete stale DbStatus after each wait
Fixes a subtle bug introduced by the use of the JSONata transition operator
with regular expression matches ( ~> |$|{'DbStatus': $match(...)} ) or with
queries that can fail. A failed match is very unlikely, and would signal a
change in the Aurora API. A failed query (of an RDS DescribeDBInstances result)
is unlikely but possible. So, it's important to handle this case correctly.
A failed match or failed query returns undefined, which leaves the key out of
the merge object. If DbStatus was set successfully on a previous iteration,
the old value persists. To prevent this, I now delete DbStatus, along with past
Error and Cause keys, at the end (Output) of the Wait state.
I chose not to do this in the Dispatch (former name) state, at the start of
an iteration, because that is a Choice state and it would be necessary to
duplicate the deletion code for DB_INSTANCE and CLUSTER.1 parent 9cfe89f commit b4c5b0f
File tree
2 files changed
+4
-4
lines changed2 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
| 148 | + | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
838 | | - | |
839 | | - | |
| 838 | + | |
| 839 | + | |
840 | 840 | | |
841 | 841 | | |
842 | 842 | | |
| |||
0 commit comments