Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .run/uvicorn.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="API_HOST" value="http://localhost:8000" />
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
Expand Down
17 changes: 5 additions & 12 deletions backend/app/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,13 @@ async def get_fs() -> Generator:


def get_rabbitmq() -> BlockingChannel:
credentials = pika.PlainCredentials("guest", "guest")
parameters = pika.ConnectionParameters("localhost", credentials=credentials)
"""Client to connect to RabbitMQ for listeners/extractors interactions."""
credentials = pika.PlainCredentials(settings.RABBITMQ_USER, settings.RABBITMQ_PASS)
parameters = pika.ConnectionParameters(
settings.RABBITMQ_HOST, credentials=credentials
)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
"""
channel.exchange_declare(
exchange="test_exchange",
exchange_type=ExchangeType.direct,
passive=False,
durable=True,
auto_delete=False,
)
channel.queue_declare(queue="standard_key")
"""
return channel


Expand Down
13 changes: 7 additions & 6 deletions backend/app/routers/listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ async def get_listeners(
"""
listeners = []
if category and label:
query = {"$and": [{"properties.categories": category},{"properties.defaultLabels": label}]}
query = {
"$and": [
{"properties.categories": category},
{"properties.defaultLabels": label},
]
}
elif category:
query = {"properties.categories": category}
elif label:
Expand All @@ -170,11 +175,7 @@ async def get_listeners(
query = {}

for doc in (
await db["listeners"]
.find(query)
.skip(skip)
.limit(limit)
.to_list(length=limit)
await db["listeners"].find(query).skip(skip).limit(limit).to_list(length=limit)
):
listeners.append(EventListenerOut.from_mongo(doc))
return listeners
Expand Down