mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-26 15:57:16 +00:00
fix: [FeederImporter] add all objects in queue
This commit is contained in:
parent
d526b2fd98
commit
9031376b50
1 changed files with 7 additions and 7 deletions
|
@ -103,14 +103,16 @@ class FeederImporter(AbstractImporter):
|
||||||
if data_obj:
|
if data_obj:
|
||||||
objs.add(data_obj)
|
objs.add(data_obj)
|
||||||
|
|
||||||
|
objs_messages = []
|
||||||
for obj in objs:
|
for obj in objs:
|
||||||
if obj.type == 'item': # object save on disk as file (Items)
|
if obj.type == 'item': # object save on disk as file (Items)
|
||||||
gzip64_content = feeder.get_gzip64_content()
|
gzip64_content = feeder.get_gzip64_content()
|
||||||
return obj, f'{feeder_name} {gzip64_content}'
|
relay_message = f'{feeder_name} {gzip64_content}'
|
||||||
|
objs_messages.append({'obj': obj, 'message': relay_message})
|
||||||
else: # Messages save on DB
|
else: # Messages save on DB
|
||||||
if obj.exists() and obj.type != 'chat':
|
if obj.exists() and obj.type != 'chat':
|
||||||
return obj, f'{feeder_name}'
|
objs_messages.append({'obj': obj, 'message': feeder_name})
|
||||||
|
return objs_messages
|
||||||
|
|
||||||
class FeederModuleImporter(AbstractModule):
|
class FeederModuleImporter(AbstractModule):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -128,10 +130,8 @@ class FeederModuleImporter(AbstractModule):
|
||||||
def compute(self, message):
|
def compute(self, message):
|
||||||
# TODO HANDLE Invalid JSON
|
# TODO HANDLE Invalid JSON
|
||||||
json_data = json.loads(message)
|
json_data = json.loads(message)
|
||||||
# TODO multiple objs + messages
|
for obj_message in self.importer.importer(json_data):
|
||||||
obj, relay_message = self.importer.importer(json_data)
|
self.add_message_to_queue(obj=obj_message['obj'], message=obj_message['message'])
|
||||||
####
|
|
||||||
self.add_message_to_queue(obj=obj, message=relay_message)
|
|
||||||
|
|
||||||
|
|
||||||
# Launch Importer
|
# Launch Importer
|
||||||
|
|
Loading…
Reference in a new issue