Closed Oroneki closed 6 years ago
Your mutate method is async, so it returns before dgraph callbacks have completed. If you do something like
public async mutateAndCheck() {
await confirmaUsuarioViaUuid("some user id");
await queryUserByUuid("some user id");
}
You should see that the data is read back correctly, even without a setTimeout. This is normal behaviour of JS async methods.
I haven't tested this code locally, but pretty sure that's the culprit. Closing the issue for now, if my suggested fix still has a problem - please feel free to reopen and I will take another look.
I am testing the above method. When I use ratel to see if the changes were persisted I can confirm they were, but my test always show the debug messages "assigned --- ", "commit --- " and "foi --- " after the test been runned. My test is not the problem since I make a call to that method and AFTER the method returns I do another cal to the function below:
The value "confirmado" I receive after calling the second method is still undefined for a moment. If I put a setTimeout on it it returns "true" as expected. I concluded that the "commit" call on the transaction still takes some milisseconds to fully concludes but releases the method before...
Am I missing something or it is really a bug ?