Module: deluge
Branch: master
Commit: 02b71451c6309e8645f49ca5c7a28d95199ac031

Author: Andrew Resch <[email protected]>
Date:   Fri Apr  9 11:21:07 2010 -0700

Fix enabling the Freespace plugin by initalizing self._timer on enable()
Stop the timer on disable()

---

 deluge/plugins/freespace/freespace/core.py |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/deluge/plugins/freespace/freespace/core.py 
b/deluge/plugins/freespace/freespace/core.py
index 03ad66b..42aed12 100644
--- a/deluge/plugins/freespace/freespace/core.py
+++ b/deluge/plugins/freespace/freespace/core.py
@@ -73,10 +73,7 @@ class Core(CorePluginBase):
                                                          DEFAULT_PREFS)
         self.notifications_sent = {}
 
-        if not self._timer:
-            self._timer = task.LoopingCall(self.update)
-        else:
-            self._timer.stop()
+        self._timer = task.LoopingCall(self.update)
         self._interval = 60 * 5 # every 5 minutes
         if self.config['enabled']:
             self._timer.start(self._interval, False)
@@ -111,6 +108,8 @@ class Core(CorePluginBase):
             "PluginDisabledEvent", self.__on_plugin_disabled
         )
         self._cleanup.stop()
+        if self._timer.running:
+            self._timer.stop()
 
     def update(self):
         log.debug('Updating %s FreeSpace', self.__class__.__name__)
@@ -200,4 +199,3 @@ class Core(CorePluginBase):
                 log.debug("Removing old(%s) path from notified paths: %s",
                           when, path)
                 self.notifications_sent.pop(path)
-

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to