You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And I made a function to query with two attributes as below, contactAddress, ChainId, and if it already exists, I don't add it to the DB, but if it doesn't, I add it.
However, if the addTokenModel function is continuously executed asynchronously, it is not possible to find a model that already exists in the same DB, but write to the DB, and in conclusion, the id is different, but a row with the same chainId and contactAddress occurs.
That is, when the first run and the second run occur at the same time, it doesn't seem to refer to the tokenModel that has already been created in the second run.
However, if '${chainId}-${contactAddress}' is designated as id and searched as id, this is not the case. Even after continuous testing, there was no error that occurred when the id was overwritten twice.
I already left chainId and contactAddress isIndexed when I designed the schema.
But I wonder why this difference occurred.
Is this a coincidence?
The text was updated successfully, but these errors were encountered:
It shouldn't have a difference if your methods are get method is working properly (awaiting all the queries properly etc) but I'm not 100% sure. You would probably need to post the code for anyone to be able to help debug but ideally just try logging every step of all our methods and you should be able to find the part causing the issue
I constructed the token model as Watermelon's model as follows.
The id is set to be generated automatically.
And I made a function to query with two attributes as below, contactAddress, ChainId, and if it already exists, I don't add it to the DB, but if it doesn't, I add it.
However, if the addTokenModel function is continuously executed asynchronously, it is not possible to find a model that already exists in the same DB, but write to the DB, and in conclusion, the id is different, but a row with the same chainId and contactAddress occurs.
That is, when the first run and the second run occur at the same time, it doesn't seem to refer to the tokenModel that has already been created in the second run.
However, if '${chainId}-${contactAddress}' is designated as id and searched as id, this is not the case. Even after continuous testing, there was no error that occurred when the id was overwritten twice.
I already left chainId and contactAddress isIndexed when I designed the schema.
But I wonder why this difference occurred.
Is this a coincidence?
The text was updated successfully, but these errors were encountered: