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

[16.0]Fast API Endpoints Cache #391

Open
hassan510-cmd opened this issue Nov 6, 2023 · 5 comments
Open

[16.0]Fast API Endpoints Cache #391

hassan510-cmd opened this issue Nov 6, 2023 · 5 comments
Labels
bug Something isn't working no stale Use this label to prevent the automated stale action from closing this PR/Issue.

Comments

@hassan510-cmd
Copy link
Member

Module

fast API

Describe the bug

when I try to create a new app with such an endpoint as root_path into data dir and some routes, it's required to update the module to be able to access
this endpoint

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. create a new module depending on fastapi with some routes
  2. create an endpoint in the data dir to be created during the installation
  3. try to access even the docs URL it'll not founded
  4. go to apps -> update your custom module
  5. try to access it again, it works fine now

Expected behavior
the newly created endpoint should work properly without the need to update the module

@hassan510-cmd hassan510-cmd added the bug Something isn't working label Nov 6, 2023
@hassan510-cmd hassan510-cmd changed the title Fast API Endpoints Cache [16.0]Fast API Endpoints Cache Nov 6, 2023
@lmignon
Copy link
Sponsor Contributor

lmignon commented Nov 7, 2023

@hassan510-cmd IMO this problem comes from the endpoint_route_handler addon. @simahawk what do you thing about?

@hassan510-cmd
Copy link
Member Author

@lmignon i try to upgrade endpoint_route_handler instead of upgrade my module, it work fine also

I think you are right

@hassan510-cmd
Copy link
Member Author

@lmignon @simahawk anything new about this issue ?

@hassan510-cmd
Copy link
Member Author

Dears,
after some dubbing, I have found that the first synced endpoint not working until you sync another one, and I tried to get an explanation for this behavior :
1- we have a table called "endpoint_route" This table contains new custom routes
2- we have a sequence called "endpoint_route_version" that has 2 triggers before inserting and update
3- according to the incremental start with 1 and INCREMENT BY 1 at first time the "last_version" col in "endpoint_route_version" equal to 1
4- after syncing the first endpoint the last version does not change
5- in the override method called routing_map its check on 2 conditions, the second one check if the _endpoint_route_last_version is less than the "last_version" col in "endpoint_route_version" which at first sync endpoint will be equal so, there is no new route will be mapped until you sync another endpoint so the _endpoint_route_last_version will be less than the "last_version" col in "endpoint_route_version" so the super method will work properly case of clear the cls._routing_map

I suggest 2 solutions to handle the first sync endpoint:
1- change check condition to be cls._endpoint_route_last_version <= last_version
or
2- add 3rd condition which delete the "_routing_map" attr so the cls._routing_map will get cleared also

In this fork i have applied the first solution

Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 12, 2024
@lmignon lmignon added no stale Use this label to prevent the automated stale action from closing this PR/Issue. and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no stale Use this label to prevent the automated stale action from closing this PR/Issue.
Projects
None yet
Development

No branches or pull requests

2 participants