-
Notifications
You must be signed in to change notification settings - Fork 163
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
[BUG] @repeat_every blocks app startup on version 0.6.0 #305
Comments
++, the app does not start. It also seems that the option |
Mommy always told me: lock your dependencies. But I never listened to her. Now I lost several hours on a deadline week figuring out why the server is not starting. |
Same issue here. from fastapi_utils.tasks import repeat_every
File "/home/iheredia/anaconda3/lib/python3.8/site-packages/fastapi_utils/__init__.py", line 4, in <module>
from .cbv_base import Api, Resource, set_responses, take_init_parameters
File "/home/iheredia/anaconda3/lib/python3.8/site-packages/fastapi_utils/cbv_base.py", line 5, in <module>
from .cbv import INCLUDE_INIT_PARAMS_KEY, RETURN_TYPES_FUNC_KEY, _cbv
File "/home/iheredia/anaconda3/lib/python3.8/site-packages/fastapi_utils/cbv.py", line 21, in <module>
from typing_inspect import is_classvar
ModuleNotFoundError: No module named 'typing_inspect' |
Same issue. My app doesn't start after update to 0.6.0 |
Same here, needs fixing asap |
Same here, and during my struggle to fix the issue I found that the typing_inspect module's imported within fastapi-restful but it's not listed as a dependency so it has to be installed separately via pip. Would that be worth a separate issue/PR? |
This issue broke all my apps that relied on fastapi-utils for cron. Really need to start locking my dependencies. |
Seems like await (https://github.com/dmontagu/fastapi-utils/blob/master/fastapi_utils/tasks.py#L77) is the cause of the problem, it should be asyncio.ensure_future or Thread().start() |
I just tested replacing (https://github.com/dmontagu/fastapi-utils/blob/master/fastapi_utils/tasks.py#L77) with |
@Keiishu can you raise a PR? |
I've seen another issue aimed to solve another problem that caused this issue, I intend to approve any PR made about it but I want the former issue not to come back EDIT: |
@yuval9313 The former issue and PR aimed to remove @asynccontextmanager
async def lifespan(app: FastAPI):
log.info(f'Starting {cfg.api_name} v{cfg.api_version} server')
await scan_results()
yield
log.info(f'Shutting down {cfg.api_name} v{cfg.api_version} server')
@utils_common.repeat(seconds=60, delay=30)
async def scan_results():
report.scan_results()
app = FastAPI(lifespan=lifespan) So unlike the issue title is suggesting I don't think such bug (repeat working only once) will happen, and the tests from pytest have confirmed this. |
Solved in #310 |
@yuval9313 I'm on 0.7.0 (latest) and still facing issues:
I simply installed with poetry, got 0.7.0, but seems something is missing.
|
Okay fixed when I installed with [all]. Nevermind. But docs need correction!
|
Sorry about the docs, the CI should've deployed the latest version with the fix, I'll check it soon! |
I can confirm what @RamiAwar commented. It still is an issue on |
It should be ok when installed via |
Describe the bug
On version 0.2.1 there is no problem, but when using 0.6.0 the app doesn't start. Attaching simple code to reproduce
To Reproduce
Expected behavior
App should start
Environment:
The text was updated successfully, but these errors were encountered: