Skip to content
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

Use a .start() method? #380

Closed
Dreamsorcerer opened this issue Dec 31, 2022 · 2 comments · Fixed by #526
Closed

Use a .start() method? #380

Dreamsorcerer opened this issue Dec 31, 2022 · 2 comments · Fixed by #526
Assignees

Comments

@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Dec 31, 2022

Related to #69.

I'm wondering if we should move the creation of the wait_failed task to a .start() method or similar, so that it is not a mistake to instantiate the Scheduler outside of a running loop.

So valid code could look like:

scheduler = Scheduler()

async def main():
    scheduler.start()
    await scheduler.spawn(coro())

I'd like to hear some thoughts from @asvetlov, so leaving this here.

@asvetlov
Copy link
Member

Well, why not?

@asvetlov
Copy link
Member

.start() shouldn't be a part of public API IMHO, we can do lazy initialization with check for the same loop in async functions, like asyncio does for locks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants