send a rabbit message regardless of file size
@@ -57,9 +57,7 @@ class GZHandler(PatternMatchingEventHandler):
historicalSize = os.path.getsize(spath)
time.sleep(0.1)
- if os.path.getsize(spath) == 0:
spath = str(spath)
- print('file drop ignoring empty file: {0}'.format(spath))
if spath.startswith('/files/trace_'):
key = spath.split('_')[1]
# Rabbit settings
@@ -68,7 +66,14 @@ class GZHandler(PatternMatchingEventHandler):
routing_key = 'poseidon.algos.decider'
message = {}
- message[key] = {'valid': False, 'source': 'file_drop'}
+ if os.path.getsize(spath) == 0:
+ print(
+ 'file drop ignoring empty file: {0}'.format(spath))
+ message[key] = {
+ 'valid': False, 'source': 'file_drop', 'plugin': 'ncapture', 'file': spath}
+ else:
+ message[key] = {
+ 'valid': True, 'source': 'file_drop', 'plugin': 'ncapture', 'file': spath}
message = json.dumps(message)
# Send Rabbit message
@@ -89,6 +94,7 @@ class GZHandler(PatternMatchingEventHandler):
print('failed to send rabbit message because: ' +
str(e))
+ if os.path.getsize(spath) == 0:
return
# check if the file was already queued and ignore
