provide event for redis state expiry#6194
Merged
adhami3310 merged 3 commits intomainfrom Mar 19, 2026
Merged
Conversation
Contributor
Greptile SummaryThis PR propagates the triggering Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant App
participant StateProxy
participant StateManagerRedis
participant Redis
Client->>App: Event (e.g. on_click)
App->>App: _process_background(state, event)
App->>StateProxy: StateProxy(substate, event)
Note over StateProxy: stores _self_event = event
StateProxy->>App: modify_state(token, background=True, event=self._self_event)
App->>StateManagerRedis: modify_state_with_links(token, event=event)
StateManagerRedis->>StateManagerRedis: _try_modify_state(token, event=event)
Note over StateManagerRedis: event_name = event.name
StateManagerRedis->>StateManagerRedis: _lock(token, event_name=event_name)
Note over StateManagerRedis: lock_id = f"{event_name}_{uuid_hex}".encode()
StateManagerRedis->>Redis: SET lock_key lock_id PX lock_expiration
Redis-->>StateManagerRedis: OK
StateManagerRedis-->>App: yields state
App-->>StateProxy: yields mutable_state
StateProxy->>StateManagerRedis: set_state(token, state, lock_id=lock_id, event=event)
StateManagerRedis->>Redis: GET lock_key
Redis-->>StateManagerRedis: existing_lock_id
alt lock_id matches
StateManagerRedis->>Redis: SET substate_key pickle_state
else lock expired
StateManagerRedis->>StateManagerRedis: LockExpiredError\n"Current lock id: {existing_lock_id!r},\nexpected: {lock_id!r}.\nHappened in event: {event.name}"
end
|
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
masenf
approved these changes
Mar 19, 2026
adhami3310
added a commit
that referenced
this pull request
Mar 19, 2026
* provide event for redis state expiry * sad * use : instead of _ Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.
No description provided.