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 = AirtimeMediaMonitorBootstrap(logger, pe, api_client, mmc)
|
||||||
bootstrap.scan()
|
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()
|
notifier.coalesce_events()
|
||||||
|
|
||||||
#create 5 worker threads
|
#create 5 worker threads
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import socket
|
import socket
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
|
|
||||||
import pyinotify
|
import pyinotify
|
||||||
from pyinotify import ProcessEvent
|
from pyinotify import ProcessEvent
|
||||||
|
@ -90,6 +91,7 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
|
|
||||||
def process_IN_CREATE(self, event):
|
def process_IN_CREATE(self, event):
|
||||||
self.logger.info("event: %s", event)
|
self.logger.info("event: %s", event)
|
||||||
|
if not event.dir:
|
||||||
# record the timestamp of the time on IN_CREATE event
|
# record the timestamp of the time on IN_CREATE event
|
||||||
self.create_dict[event.pathname] = time.time()
|
self.create_dict[event.pathname] = time.time()
|
||||||
|
|
||||||
|
@ -268,7 +270,17 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
# this part is like a garbage collector
|
# this part is like a garbage collector
|
||||||
for k, t in self.create_dict.items():
|
for k, t in self.create_dict.items():
|
||||||
now = time.time()
|
now = time.time()
|
||||||
if now - t > 300:
|
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]
|
del self.create_dict[k]
|
||||||
|
|
||||||
#check for any events received from Airtime.
|
#check for any events received from Airtime.
|
||||||
|
|
Loading…
Reference in New Issue