Skip to content

Commit d5ffff6

Browse files
committed
Generate PDF from async to sync
1 parent 146ea74 commit d5ffff6

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/worker/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import arq
22
from arq import cron, run_worker
33
from foxglove import glove
4-
from pydf import AsyncPydf
54

65
from src.ext import Mandrill, MessageBird
76
from src.settings import Settings
@@ -19,7 +18,6 @@ async def startup(ctx):
1918
sms_click_url=f'{settings.click_host_name}/l',
2019
mandrill=Mandrill(settings=settings),
2120
messagebird=MessageBird(settings=settings),
22-
pydf=AsyncPydf(),
2321
)
2422
await glove.startup(run_migrations=False)
2523

src/worker/email.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from httpx import ConnectError
1313
from itertools import chain
1414
from pathlib import Path
15+
from pydf import generate_pdf
1516
from typing import List, Optional
1617

1718
from src.ext import ApiError
@@ -206,7 +207,7 @@ async def _generate_base64_pdf(self, pdf_attachments):
206207
for a in pdf_attachments:
207208
if a.html:
208209
try:
209-
pdf_content = await self.ctx['pydf'].generate_pdf(a.html, **kwargs)
210+
pdf_content = generate_pdf(a.html, **kwargs)
210211
except RuntimeError as e:
211212
main_logger.warning('error generating pdf, data: %s', e)
212213
else:

0 commit comments

Comments
 (0)