Skip to content

Commit

Permalink
commit add (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
grigoriev-semyon authored Dec 15, 2023
1 parent 39dc6ec commit 08fa012
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions aciniformes_backend/worker/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ async def write_alert(self, alert: AlertCreateSchema):
receivers = session.query(Receiver).all()
alert = Alert(**alert.model_dump(exclude_none=True))
session.add(alert)
for receiver in receivers:
async with aiohttp.ClientSession() as s:
async with s.request(method=receiver.method, url=receiver.url, data=receiver.receiver_body):
pass
for receiver in receivers:
async with aiohttp.ClientSession() as s:
async with s.request(method=receiver.method, url=receiver.url, data=receiver.receiver_body):
pass
session.commit()

@staticmethod
def _parse_timedelta(fetcher: Fetcher) -> tuple[int, int]:
Expand Down Expand Up @@ -148,6 +149,7 @@ def add_metric(self, metric: MetricCreateSchema):
with session_factory() as session:
metric = Metric(**metric.model_dump(exclude_none=True))
session.add(metric)
session.commit()
return metric

async def _fetch_it(self, fetcher: Fetcher):
Expand Down
2 changes: 1 addition & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ httpx
isort
pytest
pytest_mock
pytest-asyncio
pytest-asyncio==0.21.1
pytest-cov
requests

0 comments on commit 08fa012

Please sign in to comment.