-
Notifications
You must be signed in to change notification settings - Fork 5
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
added polling when checking if a user is donating to a collective #137
Conversation
@krisbitney if this only for the case where a user just started a stream donation its too extensive.
|
Hmm it should check for new data every 1 second, and only for this query on this page. Are you sure it is increasing the amount of network requests that significantly? It shouldn't pull data from the subgraph unless there is new data. The purpose was to resolve this issue: #136 |
@krisbitney compared it against dev-goodcollective.vercel.app. below is from this pr deployment |
Can this be because of the flowrate and timestamps updating? |
The flowrate doesn't work by repeatedly fetching. It shouldn't affect it. I'm not sure the cause but I will look into it. It might just be because of fetching every 1 second vs every 5 seconds. I guess that would be a 5x increase, but it should be only for this one query. |
No I meant because of time stamps updating there is always new data to fetch? |
If you mean this timestamp, it only updates when the smart contract event is triggered. The timestamp refers to that last time the donor-collective relationship was updated. It shouldn't change otherwise. query DONOR_COLLECTIVE_BY_ENTITIES($donor: String, $collective: String) {
donorCollectives(where: { donor: $donor, collective: $collective }) {
id
donor {
id
}
collective {
id
}
contribution
flowRate
timestamp
}
} |
@L03TJ3 In your screenshot, you got 46 API requests related to the graph. I got a similar number in my test locally. When testing the master branch locally, I got about 30. Here are screenshots. The first one is the master branch, and the second is this PR's branch. |
Ye I stupidely looked at the wrong digita, apologies |
@krisbitney but besides my wrong analysis about the count of the events. you are saying that it should not keep polling indefinitely correct? so is there then still something wrong with the caching, or?? idk |
It polls indefinitely, so long as the user is on this page. There is nothing wrong with the caching. The polling is intended to make sure the data this query is fetching gets updates as soon as possible. It checks if there is new data, and only downloads it if it exists. |
@krisbitney @L03TJ3 the optimal solution from my POV, is to refetch just once X seconds after the user TX completes |
# Conflicts: # packages/app/src/components/ViewCollective.tsx # packages/app/src/models/constants.ts
I changed it to an env variable with a default 30 seconds. If it doesn't fix #136 then you can change the interval or implement Hadar's solution. |
Was better and will work for now. @patpedrosa @L03TJ3 Created a ticket to revisit modal language to message that things may take a while / encourage patience :) Closing this issue. |
This should improve the speed at which the app can detect if it should show the option to stop donating