CC-3016: Import files doesn't work on Debian(1.9.5, 2.0)
- fixed
This commit is contained in:
parent
3675e3c6e7
commit
a85f284296
|
@ -64,7 +64,7 @@ try:
|
|||
bootstrap = AirtimeMediaMonitorBootstrap(logger, pe, api_client, mmc)
|
||||
bootstrap.scan()
|
||||
|
||||
notifier = AirtimeNotifier(wm, pe, read_freq=0.1, timeout=0, airtime_config=config, api_client=api_client, bootstrap=bootstrap, mmc=mmc)
|
||||
notifier = AirtimeNotifier(wm, pe, read_freq=0, timeout=0, airtime_config=config, api_client=api_client, bootstrap=bootstrap, mmc=mmc)
|
||||
notifier.coalesce_events()
|
||||
|
||||
#create 5 worker threads
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import socket
|
||||
import logging
|
||||
import time
|
||||
import os
|
||||
|
||||
import pyinotify
|
||||
from pyinotify import ProcessEvent
|
||||
|
@ -90,8 +91,9 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
|
||||
def process_IN_CREATE(self, event):
|
||||
self.logger.info("event: %s", event)
|
||||
# record the timestamp of the time on IN_CREATE event
|
||||
self.create_dict[event.pathname] = time.time()
|
||||
if not event.dir:
|
||||
# record the timestamp of the time on IN_CREATE event
|
||||
self.create_dict[event.pathname] = time.time()
|
||||
|
||||
#event.dir: True if the event was raised against a directory.
|
||||
#event.name: filename
|
||||
|
@ -268,8 +270,18 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
# this part is like a garbage collector
|
||||
for k, t in self.create_dict.items():
|
||||
now = time.time()
|
||||
if now - t > 300:
|
||||
del self.create_dict[k]
|
||||
if now - t > 5:
|
||||
# check if file exist
|
||||
if os.path.exists(k):
|
||||
# check if file is open
|
||||
command = "lsof "+k
|
||||
f = os.popen(command)
|
||||
if not f.readlines():
|
||||
self.logger.info("Handling file: %s", k)
|
||||
self.handle_created_file(False, k, os.path.basename(k))
|
||||
del self.create_dict[k]
|
||||
else:
|
||||
del self.create_dict[k]
|
||||
|
||||
#check for any events received from Airtime.
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue