Skip to content

Commit

Permalink
[CacheInterceptor] Make data refresh on day change
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipin9821 authored and TusharFA committed Oct 6, 2023
1 parent d5a60b6 commit 86c96d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/interceptors/cache_interceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ abstract class ApiCacheInterceptor extends Interceptor {
}

bool isCacheValid(DateTime expirationTime) {
if (DateTime.now().isBefore(expirationTime)) {
if (expirationTime.isSameDate(DateTime.now())) {

This comment has been minimized.

Copy link
@apgapg

apgapg Nov 14, 2023

Member

Why this change? Doesnt seem correct

This comment has been minimized.

Copy link
@TusharFA

TusharFA Nov 15, 2023

Collaborator

We need to expire the the cache when the day changes. Earlier it would wait for that duration before expiring the cache.

This comment has been minimized.

Copy link
@apgapg

apgapg Nov 15, 2023

Member

Expiration time might not exactly coincide with DateTime.now,
I am afraid this function would always give 'false' case.

return true;
}

Expand Down

0 comments on commit 86c96d7

Please sign in to comment.