Open michaelsaki opened 10 months ago
@michaelsaki - Are you saying that the log output above appears if you remove asyncio.get_event_loop().run_until_complete(process_urls(cve_json_urls, write_db))
and replace it with asyncio.run(process_urls(cve_json_urls, write_db))
? I just want to make sure I understand the problem.
@jsf9k Yes that is correct. If you use asyncio.run(process_urls(cve_json_urls, write_db))
it will run only once and then crash on any subsequent runs.
🐛 Summary
When this lambda was made, we first tried to implement it using
asyncio.run(process_urls(cve_json_urls, write_db))
. This led to an error on the subsequent invocations,RuntimeError('Event loop is closed')
We were able to get a temporary fix in by using
asyncio.get_event_loop().run_until_complete(process_urls(cve_json_urls, write_db))
. This isn't an optimal solution as was discussed in the PR for this work.See also here and here.
To reproduce
Steps to reproduce the behavior:
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d @cloudwatch.json
Expected behavior
The expected behavior is the lambda should successfully run to completion upon any subsequent invocation.
Any helpful log output or screenshots
Paste the results here:
Add any screenshots of the problem here.