-
Notifications
You must be signed in to change notification settings - Fork 0
Add job for ticket garbage collection and implement stale ticket handling #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @tuhalf, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request establishes a robust system for managing the lifecycle of P2P ticket objects within the database. By introducing automatic garbage collection and defining clear criteria for ticket staleness, it ensures that the system remains efficient and free of outdated data, improving overall database health and performance. The changes encompass schema modifications, new background jobs, and integrated staleness checks during object retrieval. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a valuable ticket expiration and garbage collection system for P2P objects, which will help maintain the database by cleaning up stale ticket objects. The implementation includes a database migration for a stored_at timestamp, a new cron job for periodic cleanup, and logic to filter stale objects on read. My review focuses on potential performance improvements and enhancing code clarity. I've identified that the prune_stale_objects function could lead to high memory usage with a large database and have suggested a more scalable batching approach. Additionally, I've provided suggestions to make some parts of the code more idiomatic and concise. Regarding your question about deleting tickets used for payments, the current logic correctly implements a cleanup strategy for a distributed cache. It assumes that tickets that are old (by time or epoch) are no longer relevant, which is a reasonable approach as submitted tickets are recorded on-chain.
This pull request introduces a ticket expiration and garbage collection system for P2P objects, primarily focusing on cleaning up stale ticket objects from the database. It modifies the storage and retrieval logic for objects, adds new periodic cleanup jobs, and includes supporting tests to ensure stale tickets are properly expired and removed.
I am not sure about if I delete tickets that's used for payments or not. I need you to check that @dominicletz