Add Lock
This commit is contained in:
parent
1615fc8817
commit
2e22a17610
@ -7,6 +7,7 @@ import platform
|
|||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
from threading import Lock
|
||||||
|
|
||||||
import pwnagotchi
|
import pwnagotchi
|
||||||
import pwnagotchi.plugins as plugins
|
import pwnagotchi.plugins as plugins
|
||||||
@ -150,6 +151,7 @@ class AutoUpdate(plugins.Plugin):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ready = False
|
self.ready = False
|
||||||
self.status = StatusFile('/root/.auto-update')
|
self.status = StatusFile('/root/.auto-update')
|
||||||
|
self.lock = Lock()
|
||||||
|
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
if 'interval' not in self.options or ('interval' in self.options and self.options['interval'] is None):
|
if 'interval' not in self.options or ('interval' in self.options and self.options['interval'] is None):
|
||||||
@ -159,6 +161,7 @@ class AutoUpdate(plugins.Plugin):
|
|||||||
logging.info("[update] plugin loaded.")
|
logging.info("[update] plugin loaded.")
|
||||||
|
|
||||||
def on_internet_available(self, agent):
|
def on_internet_available(self, agent):
|
||||||
|
with self.lock:
|
||||||
logging.debug("[update] internet connectivity is available (ready %s)" % self.ready)
|
logging.debug("[update] internet connectivity is available (ready %s)" % self.ready)
|
||||||
|
|
||||||
if not self.ready:
|
if not self.ready:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user