Skip to content

Adds chatroom example using DO hibernation API - #53

Merged
dom96 merged 2 commits into
mainfrom
dominik/chatroom
Nov 26, 2025
Merged

Adds chatroom example using DO hibernation API#53
dom96 merged 2 commits into
mainfrom
dominik/chatroom

Conversation

@dom96

@dom96 dom96 commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Works locally but still waiting for fixes to be released out to the validator.
Screenshot 2025-11-21 at 14 40 48

@dom96
dom96 requested review from hoodmane and ryanking13 November 21, 2025 14:37
@dom96
dom96 marked this pull request as ready for review November 21, 2025 14:37
@dom96
dom96 force-pushed the dominik/chatroom branch 2 times, most recently from 7fea939 to 1bd9dc9 Compare November 21, 2025 14:40
Comment thread 15-chatroom/src/entry.py Outdated
Comment thread 15-chatroom/src/entry.py Outdated
Comment thread 15-chatroom/src/entry.py
Comment on lines +16 to +17
self.message_history = [] # Limited message history
self.max_history = 50 # Maximum number of messages to keep

@hoodmane hoodmane Nov 25, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make message_history into a deque:

from collections import deque

self.message_history = deque(maxlen=50)

Old messages then get discarded automatically.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but that fails with:

TypeError: Object of type deque is not JSON serializable

@hoodmane hoodmane left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I left a couple of minor comments.

@dom96
dom96 merged commit 4e8066e into main Nov 26, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants