Both Dell routes held a pooled connection open for the duration of the vendor HTTP call. sync_dell was the severe case: bulk_lookup asks Dell about 100 service tags per request and calls them sequentially, so a fleet-sized sync pinned one connection for minutes. On gevent workers that exhausts the pool and fails every request in the application, not just warranty. Copy the values the lookup needs into locals, commit to return the connection, then reacquire for the writes. The locals are load-bearing: a commit expires loaded attributes, so reading them afterwards would quietly check a connection back out and restore the defect. Preload the existing warranty links in one query. The write loop ran a query per asset plus one per link, which would have traded the long network hold for a long write transaction. Transaction boundaries do not show up in behavioural tests, so the new tests assert session state at the moment the provider is called. Both were confirmed to fail against the unfixed code, including the post-commit attribute-access variant that leaves all other tests green. Single commit and the existing error handling are unchanged, so the sync stays all-or-nothing.
26 KiB
26 KiB