Skip to content
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

Redis for State Management of Time Tracking Time Entry #13

Closed
seyedali-dev opened this issue May 12, 2024 · 0 comments · Fixed by #27
Closed

Redis for State Management of Time Tracking Time Entry #13

seyedali-dev opened this issue May 12, 2024 · 0 comments · Fixed by #27
Assignees
Labels
enhancement Enhance a feature new feature New feature testing Implement testing

Comments

@seyedali-dev
Copy link
Owner

  • Persistence Across Restarts: If our application restarts or crashes, any in-memory data (like start times) would be lost. Redis can persist this data outside of our application’s process, allowing us to recover the state after a restart.

  • Scalability: As our application grows to handle more users, we might scale it across multiple servers. Redis provides a centralized place to store session data that all instances of our application can access, ensuring consistency across the system.

  • Performance: Redis is designed for high performance and can handle a large number of read/write operations very quickly, which is ideal for time-sensitive operations like time tracking.

@seyedali-dev seyedali-dev added enhancement Enhance a feature new feature New feature testing Implement testing labels May 12, 2024
@seyedali-dev seyedali-dev self-assigned this May 12, 2024
seyedali-dev added a commit that referenced this issue May 19, 2024
seyedali-dev added a commit that referenced this issue May 20, 2024
 #13)

# Issue
We encountered a `LazyInitializationException` when trying to access the `timeSegmentList` of a `TimeEntry` object that was retrieved from the cache. This happened because the `timeSegmentList` was lazily loaded by Hibernate, and we were trying to access it after the Hibernate Session had been closed.

# Temporary Solution
We resolved this issue by forcing the initialization of the `timeSegmentList` before caching the `TimeEntry` object. We did this by calling `size()` on the `timeSegmentList` in the `getTimeEntryById` method. This ensured that the list was fetched from the database and included in the cached `TimeEntry`.

```java
timeEntry.getTimeSegmentList().size(); // This will initialize the timeSegmentList
```
> ## Note
>  This solution might have performance implications if the timeSegmentList is large, as it will always be fetched from the database even if it’s not needed. Therefore, this solution is not recommended for large data sets. We are currently exploring more efficient solutions.
seyedali-dev added a commit that referenced this issue May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhance a feature new feature New feature testing Implement testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant