Commit 6e76235
committed
fix: make background sync non-blocking on unsynced stores
Background reconciliation and governance sync tasks could block for up
to 10 minutes per call on known-unsynced datalayer stores, and the V1
governance sync recursively retried up to 50 times on every failure.
This caused visible startup and task-cadence stalls.
- Add sync-status pre-checks to V1 and V2 reconcileOrganization: subscribe
to the org store so it starts syncing, then skip reconcile on the next
task run if either the org store or its derived singleton is unsynced.
- Replace recursive retry in V1/V2 governance sync with a single attempt
per task invocation. On failure the function logs and returns; the
scheduler re-runs the task on its normal cadence, so the coroutine
never blocks its scheduler slot.
- Skip governance sync immediately when the body store or its versioned
governance store reports unsynced, preserving cached governance data.
- Keep the production wait-loop in getRegistryStoreIdFromSingleton so
request-path callers (subscribe controller, import flow) still work
on newly-discovered stores; the reconcile pre-check makes the wait a
no-op on the background path.
- Standardize the governance sync interval to 300 seconds (5 minutes)
across defaults, task fallbacks, example env, and test config. The
sync pre-check is a single lightweight RPC so running every 5 minutes
is safe.
- Add focused tests for reconcile and governance non-blocking behavior,
idempotency, and schedule configuration.1 parent 8faec6d commit 6e76235
12 files changed
Lines changed: 627 additions & 124 deletions
File tree
- src
- models
- governance
- organizations
- v2
- tasks
- utils
- tests/v2
- config
- integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 158 | + | |
| 159 | + | |
161 | 160 | | |
162 | | - | |
163 | | - | |
164 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
165 | 172 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
175 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
176 | 187 | | |
177 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
178 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
179 | 200 | | |
180 | 201 | | |
181 | 202 | | |
182 | | - | |
| 203 | + | |
183 | 204 | | |
184 | 205 | | |
185 | | - | |
186 | 206 | | |
187 | 207 | | |
188 | 208 | | |
189 | 209 | | |
190 | 210 | | |
191 | 211 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
| 212 | + | |
197 | 213 | | |
| 214 | + | |
| 215 | + | |
198 | 216 | | |
199 | 217 | | |
200 | | - | |
201 | 218 | | |
202 | 219 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
211 | 223 | | |
| 224 | + | |
| 225 | + | |
212 | 226 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
220 | 239 | | |
| 240 | + | |
221 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
222 | 253 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
235 | 257 | | |
236 | 258 | | |
237 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
830 | 830 | | |
831 | 831 | | |
832 | 832 | | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
833 | 880 | | |
834 | 881 | | |
835 | 882 | | |
| |||
0 commit comments