mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-18 14:26:24 +00:00
The !FreeSpace plugin only calculates free-space on existing directories. Cleaned-up logging.
This commit is contained in:
parent
177ec7d5c2
commit
eee6d4c030
@ -113,18 +113,20 @@ class Core(CorePluginBase):
|
|||||||
self._cleanup.stop()
|
self._cleanup.stop()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
log.debug('\n\nUpdating %s FreeSpace', self.__class__.__name__)
|
log.debug('Updating %s FreeSpace', self.__class__.__name__)
|
||||||
nots = {}
|
nots = {}
|
||||||
for path in self.__gather_paths_to_check():
|
for path in self.__gather_paths_to_check():
|
||||||
log.debug("Checking path %s", path)
|
log.debug("Checking path %s", path)
|
||||||
free_percent = self.__get_free_space(path)
|
if os.path.exists(path):
|
||||||
if (100 - free_percent) > self.config['percent']:
|
free_percent = self.__get_free_space(path)
|
||||||
if path not in self.notifications_sent:
|
if (100 - free_percent) > self.config['percent']:
|
||||||
self.notifications_sent[path] = datetime.utcnow()
|
if path not in self.notifications_sent:
|
||||||
nots[path] = (100 - free_percent)
|
self.notifications_sent[path] = datetime.utcnow()
|
||||||
else:
|
nots[path] = (100 - free_percent)
|
||||||
log.warning("Running low on disk space on %s but "
|
else:
|
||||||
"notifications were already triggered.", path)
|
log.warning("Running low on disk space on %s but "
|
||||||
|
"notifications were already triggered.",
|
||||||
|
path)
|
||||||
if nots:
|
if nots:
|
||||||
component.get("EventManager").emit(LowDiskSpaceEvent(nots))
|
component.get("EventManager").emit(LowDiskSpaceEvent(nots))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user