fix(session): use datetime for cutoff in suspend_recently_active() - #8002
Closed
zicochaos wants to merge 1 commit into
Closed
fix(session): use datetime for cutoff in suspend_recently_active()#8002zicochaos wants to merge 1 commit into
zicochaos wants to merge 1 commit into
Conversation
suspend_recently_active() compares entry.updated_at (datetime) with time.time() (float), raising TypeError on gateway startup. Use _now() - timedelta(seconds=...) instead to match the type of updated_at.
Contributor
|
Thanks for the contribution, @zicochaos! Closing this as a duplicate of #8026 (by @tomqiaozc), which targets the same fix/feature. We're consolidating on that PR for review. If you want to help push it over the line, please jump in there — or if you think your approach is better for a specific reason that isn't covered in the other PR, let us know and we can reopen. |
4 tasks
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
suspend_recently_active()comparesentry.updated_at(adatetimeobject) withtime.time()(afloat), which raisesTypeError: '>=' not supported between instances of 'datetime.datetime' and 'float'on every gateway startup.Fix: use
_now() - timedelta(seconds=max_age_seconds)instead oftime.time() - max_age_seconds, matching the type ofupdated_atand the pattern used elsewhere in session.py (e.g.list_sessions()).Test plan
TypeErroron startup_now()andtimedeltaare already imported in session.pylist_sessions)