-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make last_sync
a field in ClientInner
#982
Make last_sync
a field in ClientInner
#982
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can actually remove the lazy_static dependency if we want to.
If you could publish this as a new sdk-wasm version after its merged, that'd be great! |
Can you prepare a release for it in this PR then? As in, put an actual date + bump package.json |
372d44e
Description of change
When using a private tangle with HRP
tst
and multiple client instances in Wasm, the HRP that is returned fromget_network_info
issmr
on any of the client instances but the first one that calls it.The issue with the current approach for storing the last sync time is that it is a
static
. It is thus the same across different client instances. For instance, when instantiatingclient1
andclient2
and runningclient1.get_network_info()
,client1
will have the fetched protocol params from the node set. It will also update the last synced time to only fetch the params again 60s from now. However,client2
will not have the fetched protocol params set, but because the last synced time is shared withclient1
, it will also not fetch them on the first call toget_network_info
. Thusclient2
will return the default protocol parameters from the client, which issmr
for the HRP.This PR changes the last sync time from a static to a field in the client, fixing the issue.
Links to any relevant issues
n/a
Type of change
Choose a type of change, and delete any options that are not relevant.
How the change has been tested
Tested locally in concert with examples in identity where the issue occurred.
Change checklist
Tick the boxes that are relevant to your changes, and delete any items that are not.