Open ajaynegi45 opened 1 month ago
Hey @ajaynegi45 I’d love to try my hands on this issue and see how I can contribute. Could you assign it to me? Looking forward to working on it!
Hey @ajaynegi45 I’d love to try my hands on this issue and see how I can contribute. Could you assign it to me? Looking forward to working on it!
Hey @7vk,
Thanks for showing interest in tackling this issue! I'd be happy to assign it to you, but before I do, could you walk me through how you plan to implement this feature in detail?
Also, before jumping in, I recommend giving the Readme.md a thorough read. It'll help you get a solid grasp of the project's goals and purpose. Plus, check out the Contributing.md file for some handy guidelines that’ll make your contribution process smoother, especially if you're new around here.
If you run into any questions or need help along the way, don’t hesitate to reach out!
I suggest we create a separate entity to schedule reminders which would schedule the reminders when the book is borrowed. So instead of scanning all borrowings daily, we query the specific reminders that are due.
What do you think about this approach? your guidance would be much appreciated.
I suggest we create a separate entity to schedule reminders which would schedule the reminders when the book is borrowed. So instead of scanning all borrowings daily, we query the specific reminders that are due.
What do you think about this approach? your guidance would be much appreciated.
Thank you for your suggestion, @7vk!
I really appreciate your input on creating a separate entity for scheduling reminders. It's a clever approach that could indeed optimize the system. Here are a few additional considerations and suggestions that might further enhance this solution:
By introducing a separate entity for scheduling reminders, we can avoid the need for daily scans of all borrowings, significantly cutting down the number of queries and reducing the strain on the database. Instead, we could query only the reminders that are due, leading to a more efficient process.
This approach could make the system more scalable and performant, especially when handling a large volume of users and borrowings. Fewer and more targeted queries should result in noticeable improvements in speed and resource usage during the reminder process.
To ensure the robustness of this approach, we’ll need to manage certain key edge cases effectively:
If a user renews a book or if the due date changes for any reason, we need to ensure that the associated reminder is also updated. Failing to do so could result in sending incorrect reminders.
Solution:
Implement an event-driven system or listener that triggers updates to the reminder entity whenever a borrowed book’s due date is modified.
If a user returns a book early, the corresponding reminder should be removed from the system to avoid sending unnecessary notifications.
Solution:
On book return, either soft-delete or remove the scheduled reminder entity. Optionally, you can archive reminders for reporting purposes, but they should no longer be active.
Once the due date for a book passes, the system should automatically send daily notifications to the user, reminding them that the due date has passed and that a fine of Rs. 10 per day is accruing. This notification should also display the current fine amount until the book is returned.
Solution:
After the due date passes, we’ll trigger a daily reminder until the book is returned. This can be optimized by calculating the fine dynamically based on the number of days overdue, rather than updating the fine amount in the database every day.
To avoid performance bottlenecks, we can batch-process overdue reminders in off-peak hours, sending notifications and calculating fines for all overdue books at once, ensuring that the process remains scalable even with a large user base.
I've assigned this issue to you and I'm confident that your approach will make the system more optimized, faster, and scalable. Be sure to document your code thoroughly using Javadoc comments to ensure clarity and maintainability. Feel free to reach out if you have any questions or need assistance as you proceed.
Looking forward to seeing your implementation!
@ajaynegi45 I'll get it done. If I need help with anything I'll reach out.
Is this feature already requested?
Problem or Missing Functionality
The system currently sends reminder notifications 2 days before the book's due date by querying the database on daily basis to check for due books. This process may involve daily database queries, which can lead to performance inefficiencies.
Improvement Request
Optimize Database Queries:
Performance Enhancement:
Documentation:
Expected Outcome