Welcome Guest, Not a member yet? Register   Sign In
how to delay?
#1

(This post was last modified: 11-15-2020, 07:48 PM by richb201.)

I have a function that both adds a row to mySQL and also registers a user in FusionAuth which is an authentication package I am using.  The FusionAuth call that registers the user returns an ID number that I need to keep in the row in mySQL. But I am finding a race condition where FusionAuth is returning the ID number before mySQL has finished creating the record. 

So I think that I need to insert a delay in my code prior to updating the ID field in the mySQL table. If I don't, I will sometimes get an error because I am trying to update a record that doesn't exist yet. 

Is there some type of CI delay I can use or perhaps another way to deal with this race condition? Perhaps the append record in mySQL is being cached? It is being created by Grocery Crud. Is there a way to force the cache to purge before I try to update the ID number?
proof that an old dog can learn new tricks
Reply


Messages In This Thread
how to delay? - by richb201 - 11-15-2020, 07:13 PM
RE: how to delay? - by includebeer - 11-16-2020, 05:15 AM
RE: how to delay? - by richb201 - 11-16-2020, 07:07 AM
RE: how to delay? - by includebeer - 11-16-2020, 07:27 AM
RE: how to delay? - by richb201 - 11-16-2020, 08:28 AM
RE: how to delay? - by includebeer - 11-16-2020, 02:42 PM
RE: how to delay? - by InsiteFX - 11-16-2020, 12:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB