Commit f939277
committed
[card-cache] optimizations to avoid deadlocks
- deadlocks happened when cleanups coincided with heavy load
- tests simulating a cleanup (disk + shared-objects) and heavy load together were successfully able to reproduce the deadlock situation
- Locking at the `context` level:
- Each time we want to clean up we lock to create a new context
- All directories/processes are written within that new context.
- Switching this context which ensure that all new processes get created differently and the cleanup process can safely remove everything.
- Context also sets the read/write directory for the cache object used in the API endpoint.
- All locking on the API side now always time-bound. The code time's out if it can't acquire a lock.
- The method ensure that all operations won't in-definately hold the lock.
- Changed defaults for minimum amount to time to wait for cards in the cache process to 20 seconds (helps make things snappier)
- Added `timings` dict in card cache to optimize loading cycles (Ensured that it is set based on a per-card basis)1 parent d24ee48 commit f939277
File tree
4 files changed
+193
-136
lines changed- services/ui_backend_service
- api
- data/cache
4 files changed
+193
-136
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
160 | | - | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
278 | | - | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
| |||
0 commit comments