Repository navigation
Fix admin crashes and Resonate worker going idle - #4859
Merged
Merged
Conversation
Grant.__init__ snapshots status, pending_status and country_type to detect changes on save. When a field is deferred (for example when the deletion collector loads related grants with .only()), reading it refetches the row, which instantiates another Grant whose __init__ reads the next deferred field, recursing until RecursionError. Deleting a conference that has grants crashed this way. Read the snapshots from __dict__ so deferred fields stay unloaded.
- GrantResource.export_field did not accept the keyword arguments that django-import-export 4 passes (export_fields), so every export from the admin raised TypeError. With that fixed, the admin's field selection, built from get_export_order(), would also have dropped the per-question columns added in before_export; they are now always exported. - create_grant_vouchers let a Pretix error abort the whole action with a 500. Failures are now reported per grant and the remaining grants still get their vouchers. The export tests now pass the field selection the way the admin does.
validate_deadlines_form read cleaned_data["start"], ["end"] and ["type"] unconditionally, so a deadline row whose fields failed validation raised KeyError. Empty dates passed field validation (they are optional on TimeFramedModel) and then failed comparing None. Rows with field errors are now left to those errors, and both dates are required.
Both admins listed a foreign key directly in search_fields, which Django cannot search with icontains, so any search returned a 500. Search the uploader's email and the conference code instead.
The speaker ticket column in the invitations list and the invitations CSV export called Pretix without handling errors, so a failing request turned the whole page or export into a 500. Log the error and show the ticket status as unknown, as the grants list already does.
resonate-sdk opens its long-lived SSE poll stream with aiohttp's default ClientSession timeout (total=300s). When it expires aiohttp raises a bare TimeoutError, which is not an aiohttp.ClientError, so it escapes the SDK's reconnect loop and the listener task dies silently. The server then deregisters the worker and pending workflows are never dispatched until the process restarts. Give the worker its own SSE source with no total timeout (connect timeout kept at 30s), sharing the process id with the SDK.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7 of 8 tasks
Contributor
|
This PR fixes several admin 500s (grant deletion recursion, grant export, voucher creation, deadline validation, changelist search, schedule invitations) and works around the Resonate SSE 5-minute timeout with a custom poll connection. Issues
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4859 +/- ##
==========================================
- Coverage 92.43% 92.41% -0.02%
==========================================
Files 360 360
Lines 10938 10958 +20
Branches 949 953 +4
==========================================
+ Hits 10110 10127 +17
+ Misses 706 705 -1
- Partials 122 126 +4 🚀 New features to boost your workflow:
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While testing the Django 6.1 upgrade (#4858) end to end on a local instance, I hit six bugs that were already on
mainand are unrelated to that upgrade. I reproduced the first one on Django 5.2.18 as well. This PR fixes them, one commit per bug, and each fix comes with a test that fails without it.Fixes
RecursionError.Grant.__init__snapshotsstatus,pending_statusandcountry_typeso it can detect changes. When the deletion collector loads the grants with.only(), reading a deferred field reloads the row, which builds anotherGrant, whose__init__reads the next deferred field, and so on.Grant.objects.only("id").first().__dict__, so deferred fields are never loaded here.GrantResource.export_field()did not accept the**kwargs(export_fields) that django-import-export 4 passes, so every admin export raisedTypeError.get_export_order(), before the per-conference question columns are added. Those columns would have been left out, so they are now always exported.create_grant_vouchersreturned a 500 when Pretix failed. It now reports each failing grant with an admin error message and keeps creating vouchers for the remaining grants. Before, a Pretix error stopped the action halfway through.validate_deadlines_formreadcleaned_data["start"],["end"]and["type"]even when those fields had failed validation, which raisedKeyError.TimeFramedModelmakes both dates optional, and then crashed when compared withNone.search_fieldslisted a foreign key directly (uploaded_by,conference), and Django can't run anicontainslookup on that. Search now uses the uploader's email and the conference code.resonate-sdk0.8.1, the latest release. It opens its long-lived SSE poll stream with aiohttp's default session timeout,total=300s.TimeoutError. That isn't anaiohttp.ClientError, so the SDK's reconnect loop doesn't catch it and the listener task dies without logging anything._ensure_session. The test streams one event before aiohttp's default timeout runs out (the timeout is shortened to 0.5s in the test) and one after. That way it fails if the workaround stops having any effect.Test plan
main's dependencies (Django 5.2): 1376 passedRecursionError,TypeError, missing question columns,KeyError/TypeError,FieldError,HTTPError, and the SSE listener dying withTimeoutErrorGrant.objects.only("id")against the local dev database now returns the grant with its fields still deferredThis merges cleanly with #4858.