mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-16 07:06:45 +00:00
GODT-1431 Prevent watcher when not using disk on cache
- change: Rename Cacher -> MsgCachePool - change: Do not run watcher when using memory cache - add: Allow to cancel cacher jobs (added context) - change: Fix behavior on context cancel (was causing no internet)
This commit is contained in:
@ -61,18 +61,15 @@ func (f *FrontendQt) changeLocalCache(enableDiskCache bool, diskCachePath *core.
|
||||
_diskCachePath = _diskCachePath[1:]
|
||||
}
|
||||
|
||||
// If disk cache not enabled, or path not changed then no need to change location
|
||||
if !enableDiskCache || _diskCachePath == f.settings.Get(settings.CacheLocationKey) {
|
||||
return
|
||||
if enableDiskCache && _diskCachePath != f.settings.Get(settings.CacheLocationKey) {
|
||||
if err := f.bridge.MigrateCache(f.settings.Get(settings.CacheLocationKey), _diskCachePath); err != nil {
|
||||
f.log.WithError(err).Error("The local cache location could not be changed.")
|
||||
f.qml.CacheCantMove()
|
||||
return
|
||||
}
|
||||
f.settings.Set(settings.CacheLocationKey, _diskCachePath)
|
||||
}
|
||||
|
||||
if err := f.bridge.MigrateCache(f.settings.Get(settings.CacheLocationKey), _diskCachePath); err != nil {
|
||||
f.log.WithError(err).Error("The local cache location could not be changed.")
|
||||
f.qml.CacheCantMove()
|
||||
return
|
||||
}
|
||||
|
||||
f.settings.Set(settings.CacheLocationKey, _diskCachePath)
|
||||
f.qml.CacheLocationChangeSuccess()
|
||||
f.restart()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user