Skip to content

feat: set event loop to uvloop #1697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions azure_functions_worker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def main():
DependencyManager.use_worker_dependencies()

import asyncio
try:
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
except Exception:
pass

from . import logging
from .logging import error_logger, format_exception, logger
Expand All @@ -56,6 +61,7 @@ def main():
logger.info('Starting Azure Functions Python Worker.')
logger.info('Worker ID: %s, Request ID: %s, Host Address: %s:%s',
args.worker_id, args.request_id, args.host, args.port)
logger.debug('Using event loop: %s', type(asyncio.get_event_loop()))

try:
return asyncio.run(start_async(
Expand Down
Loading