0

There are 3 servers: nginx server, fastapi server and mysql server.

nginx server: web page on /admin/

fastapi server: api page on /api/select/

mysql server: stores the data (mysql version 8.3.0)

/admin/ page will post to /api/select/ when it is loaded, and /api/select/ will return all the records in table test.

The wierd thing is: when I insert a new record into table test using phpmyadmin, it will never be updated to /admin/. To be more strange, if I $.post manually in the web page, the post result will be alternately updated and unupdated.

The result of the manual posts

PS: The path /api/admin/select/company/ is aliases as /api/select/ in the question.

If I reboot the server, the post data will be updated.

I have completely no idea why this should happen.

8
  • My total guess would be some sort of caching is occurring in your API setup Commented Feb 26 at 14:53
  • I can exclude the possibility of the cache of browser, since I add some debug code in the FastAPI server, and it does reads from the database and get the wrong result.
    – OrthoPole
    Commented Feb 26 at 14:56
  • @BarryCarter I use aiomysql package in my FastAPI server. I heard that it would not store any caches.
    – OrthoPole
    Commented Feb 26 at 15:18
  • The problem seems to be solved by setting autocommit=True in aiomysql connection. However, I can't see why select query needs commit.
    – OrthoPole
    Commented Feb 26 at 15:32
  • Show us the generated SQL so we can see the ORDER BY clause.
    – Rick James
    Commented Feb 26 at 17:45

0

You must log in to answer this question.

Browse other questions tagged .