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

RuntimeWarning: coroutine 'PersistentDict.backup.<locals>.backup' was never awaited #1099

Closed
rodja opened this issue Jun 28, 2023 · 1 comment · Fixed by #1104
Closed

RuntimeWarning: coroutine 'PersistentDict.backup.<locals>.backup' was never awaited #1099

rodja opened this issue Jun 28, 2023 · 1 comment · Fixed by #1104
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rodja
Copy link
Member

rodja commented Jun 28, 2023

Description

Running multiple storage operations yield an error that the backup coroutine was never awaited. Reproduction

from nicegui import app, ui

def test():
    app.storage.general['one'] = 1
    app.storage.general['two'] = 2
    app.storage.general['three'] = 3


# ui.button('run test', on_click=test)
ui.timer(1, test, once=True)

ui.run(storage_secret='secret')

The timer will already produce the error. Swapping the timer with a button yields the same error on first button press. The issue was originally reported on Discord. I suspect something strange with our background_tasks.create_lazy function.

@rodja rodja added the bug Something isn't working label Jun 28, 2023
@rodja rodja added this to the 1.2.24 milestone Jun 28, 2023
@falkoschindler
Copy link
Contributor

Interesting... Reproduction without storage:

ui.button('sleep', on_click=lambda: (
    background_tasks.create_lazy(asyncio.sleep(0.1), name='sleep'),
    background_tasks.create_lazy(asyncio.sleep(0.2), name='sleep'),
    background_tasks.create_lazy(asyncio.sleep(0.3), name='sleep'),
))

Apparently it takes three tasks to get a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants