Skip to content
Snippets Groups Projects
Verified Commit 6ce6ac30 authored by Georg Krause's avatar Georg Krause
Browse files

fix: Remove outdated code

parent 00f84797
No related branches found
No related tags found
1 merge request!43Apply patches from the server
Pipeline #26092 failed with stage
in 2 minutes and 4 seconds
......@@ -94,7 +94,6 @@ async def domains(request):
)
domain = await serializers.create_domain(request["conn"], payload)
await request.app["crawler"].poll(payload["name"])
if domain:
payload = serializers.serialize_domain(domain)
return web.json_response(payload, status=201)
......
......@@ -11,7 +11,6 @@ def prepare_app(app, pool):
app.router.add_get("/api/domains/stats", routes.stats)
app.add_routes([web.static("/static", routes.STATIC_DIR)])
app["pool"] = pool
app["crawler"] = worker.Crawler()
async def on_shutdown(app):
......
......@@ -8,30 +8,6 @@ from aiohttp import ClientSession
from arq import cron
#class Crawler(arq.Actor):
class Crawler():
async def startup(self):
kwargs = crawler.get_session_kwargs()
self.session = aiohttp.ClientSession()#loop=self.loop, **kwargs)
self.pool = await db.get_pool(settings.DB_DSN)
#@arq.concurrent
async def poll(self, domain):
async with self.pool.acquire() as conn:
return await crawler.check(conn=conn, session=self.session, domain=domain)
#@arq.cron(minute=0, hour={0, 6, 12, 18})
async def poll_all(self):
async with self.pool.acquire() as conn:
for check in await db.get_latest_check_by_domain(conn):
await self.poll(check["domain"])
async def shutdown(self):
await self.session.close()
self.pool.close()
await self.pool.wait_closed()
async def poll(ctx, domain):
session: ClientSession = ctx['session']
pool = await db.get_pool(settings.DB_DSN)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment