1
This commit is contained in:
parent
d7511f35f5
commit
467791ee09
@ -8,4 +8,4 @@ webdriver:
|
|||||||
mongo:
|
mongo:
|
||||||
uri : 'mongodb://localhost:27017/'
|
uri : 'mongodb://localhost:27017/'
|
||||||
dbname: 'tiktok'
|
dbname: 'tiktok'
|
||||||
enabled: 0
|
enabled: 'on'
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,9 +1,14 @@
|
|||||||
import time
|
import time
|
||||||
|
import concurrent.futures
|
||||||
|
import queue
|
||||||
|
|
||||||
from watchdog.observers import Observer
|
from watchdog.observers import Observer
|
||||||
from watchdog.events import FileSystemEventHandler
|
from watchdog.events import FileSystemEventHandler
|
||||||
|
|
||||||
from messages.utils import unpackMsgBin
|
from messages.utils import unpackMsgBin
|
||||||
|
|
||||||
|
q = queue.Queue()
|
||||||
|
|
||||||
class Watcher:
|
class Watcher:
|
||||||
DIRECTORY_TO_WATCH = ""
|
DIRECTORY_TO_WATCH = ""
|
||||||
|
|
||||||
@ -18,7 +23,8 @@ class Watcher:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
time.sleep(5)
|
with concurrent.futures.ThreadPoolExecutor() as executor:
|
||||||
|
executor.submit(unpackMsgBin, q.get())
|
||||||
except:
|
except:
|
||||||
self.observer.stop()
|
self.observer.stop()
|
||||||
|
|
||||||
@ -33,5 +39,5 @@ class Handler(FileSystemEventHandler):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
elif event.event_type == 'created':
|
elif event.event_type == 'created':
|
||||||
unpackMsgBin(event.src_path)
|
q.put(event.src_path)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user