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?
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