Remove closeBox when open box in hive database

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-05-30 10:08:02 +07:00
committed by Dat H. Pham
parent 19cede1a5f
commit 02c2e08e40
12 changed files with 11 additions and 45 deletions
@@ -56,12 +56,16 @@ extension EmailCacheExtension on EmailCache {
bool expireTimeCaching(EmailCleanupRule cleanupRule) {
final currentTime = DateTime.now();
log('EmailCacheExtension::expireTimeCaching():currentTime: $currentTime | receivedAt: $receivedAt');
if (receivedAt != null) {
final countDay = currentTime.daysBetween(receivedAt!.toLocal());
log('EmailCacheExtension::expireTimeCaching():countDay: $countDay | cleanupRule.cachingEmailPeriod.countDay: ${cleanupRule.cachingEmailPeriod.countDay}');
if (countDay >= cleanupRule.cachingEmailPeriod.countDay) {
log('EmailCacheExtension::expireTimeCaching():true');
return true;
}
}
log('EmailCacheExtension::expireTimeCaching():false');
return false;
}
}
@@ -111,7 +111,7 @@ class EmailCacheManager {
Future<EmailCache> getStoredEmail(AccountId accountId, UserName userName, EmailId emailId) async {
final keyCache = TupleKey(emailId.asString, accountId.asString, userName.value).encodeKey;
final emailCache = await _emailCacheClient.getItem(keyCache, needToReopen: true);
final emailCache = await _emailCacheClient.getItem(keyCache);
if (emailCache != null) {
return emailCache;
} else {