Commit f726b1d
fix(sla): reset in-memory async_updating after dispatch
Before the pickle removal, the SLA recompute task received the
SLA_Configuration / Product instances by reference (Celery's sync
.apply() does not serialize). The inner update function set
async_updating=False on those shared instances, so the dispatcher's
local self.async_updating ended up False as well.
After switching the dispatch to pass IDs and refetch in the task, the
inner function only resets async_updating on its refetched copies.
The dispatcher's in-memory self.async_updating stayed True, so a
subsequent save() on the same instance triggered the lock-revert path
at SLA_Configuration.save() line 1058 and overwrote the caller's
field changes (e.g. enforce_critical) with the DB values.
Manifested as test_sla_expiration_date_after_sla_not_enforced failing:
sla_config.enforce_critical=False was reverted to True on save.
Reset async_updating on the in-memory caller instances after
dispatch returns to keep them consistent with the post-task DB state.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 424f490 commit f726b1d
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1099 | 1099 | | |
1100 | 1100 | | |
1101 | 1101 | | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1102 | 1106 | | |
1103 | 1107 | | |
1104 | 1108 | | |
| |||
1265 | 1269 | | |
1266 | 1270 | | |
1267 | 1271 | | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
1268 | 1278 | | |
1269 | 1279 | | |
1270 | 1280 | | |
| |||
0 commit comments