Repository navigation
Commit 4729dd1
authored
fix(redis): Preserve shared Redis index hashes when dropping a storage (#1942)
### Description
`RedisClientMixin._drop` called `pipe.delete(f'{MAIN_KEY}:id_to_name',
storage_id)` (and the same for `name_to_id`), but Redis `DEL` deletes
whole top-level keys — it does not remove a field from a hash. Since
`id_to_name` and `name_to_id` are shared hashes holding the mappings for
every storage of a given type, dropping any single
Dataset/KVS/RequestQueue wiped the entire index, breaking subsequent
`open(id=...)` calls for all sibling storages (open-by-name kept
working, since it reads metadata directly).
This replaces the two `DEL` calls with `HDEL`, removing only the dropped
storage's fields, and adds a regression test verifying that a sibling
storage's index entries survive a drop and that it can still be opened
by ID.1 parent 5a7d72a commit 4729dd1
2 files changed
Lines changed: 27 additions & 2 deletions
File tree
- src/crawlee/storage_clients/_redis
- tests/unit/storage_clients/_redis
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
224 | | - | |
| 223 | + | |
| 224 | + | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
116 | 141 | | |
117 | 142 | | |
118 | 143 | | |
| |||
0 commit comments