Web: Build - Sync with Blockchain button on the Issue Explorer

Created on 19 Nov 2018  ·  10Comments  ·  Source: gitcoinco/web

User Story

As a user, I want a way to manually sync with the blockchain so I can get the latest bounties on the Issue Explorer

Why Is this Needed

Summary: Sometimes transactions are submitted but Gitcoin doesn't properly sync with the blockchain, causing latest bounties and bounty activities to not show up.

Description

Type: Feature

Current Behavior

There is no 'Sync with Blockchain' button.

Expected Behavior

There should be a 'Sync' button at the top of Issue Explorer (see design below)
48566510-ef2c5a80-e935-11e8-9cd8-4fd48d98bdda

Definition of Done

  • [ ] A 'Sync' button is displayed at the top of Issue Explorer.
  • [ ] Clicking on the 'Sync' button should sync Gitcoin with the blockchain and update the Issue Explorer with the latest bounties and bounty activities.
  • [ ] 'Synced with blockchain X minutes ago' should be displayed at the top of Issue Explorer, showing when the last time Gitcoin was synced with the blockchain.
  • [ ] It should be obvious when syncing is in progress:
    • hide the button
    • change the 'Synced with blockchain X minutes ago' text to 'Syncing...' with a simple animated loading spinner

Additional Information

Related issues: #2388 #2403
Same button on the Issue Details page: #2885

Gitcoin Issue Explorer discussion ungroomed

Most helpful comment

I agree with @kuhnchris and @thelostone-mc - allowing a user unfettered access to refresh the entire Explorer with no limits is dangerous. To me, it also is another thing the user has to think about on the Issue Explorer. Ideally, I'd like that completely abstracted away.

I see two avenues, (not exhaustive, and definitely open to other ideas).

  1. Allow the user to refresh, but cap re-syncing until the sync job is finished. I don't recommend this.

  2. Abstract it away completely. Do not allow the user to refresh the entire explorer, and instead just have it refresh at a reasonable cadence, and don't even state when the last sync was (if the user can't refresh it, then we can have them assume that the entries are up to date, as long as we actually refresh at a reasonable cadence).

I'll investigate what the current rate of refresh is in order to better understand the problem and report back here.

All 10 comments

uh, from a backend perspective I'd say "no.". imagine 20 people pressing that button - chaos ensures!
if we need to make one, we need to create a trigger that executes the sync and blocks it AT LEAST until it's finished processing the sync job. else we gonna screw up the database hard.

any comments @mbeacom ?

@kuhnchris you are right!
@mbeacom had the same concern

@owocki / @frankchen07 / @PixelantDesign would it make sense to just show when it was last synced to the db as opposed to letting the user to sync with the blockchain ?

I agree with @kuhnchris and @thelostone-mc - allowing a user unfettered access to refresh the entire Explorer with no limits is dangerous. To me, it also is another thing the user has to think about on the Issue Explorer. Ideally, I'd like that completely abstracted away.

I see two avenues, (not exhaustive, and definitely open to other ideas).

  1. Allow the user to refresh, but cap re-syncing until the sync job is finished. I don't recommend this.

  2. Abstract it away completely. Do not allow the user to refresh the entire explorer, and instead just have it refresh at a reasonable cadence, and don't even state when the last sync was (if the user can't refresh it, then we can have them assume that the entries are up to date, as long as we actually refresh at a reasonable cadence).

I'll investigate what the current rate of refresh is in order to better understand the problem and report back here.

I'd be good with abstracting it away entierly 👍

Same, abstracting it does make more sense in the long run. Giving the user the possibility to complain/identify this as an issue they'll use it to complain, even if it's absolutely not connected at all to their issue. (at least that's the experience I had the last couple of years...)

For the "core" of this PR: actually the solution would be to not have a workaround. Can we identify the source of the issue? Do we need a separate process to sync transactions constantly/monitor them incase the 'web' docker-container restarts? (my theory: blockchain v.s. web gets unsynchronized if the docker-container restarts or redeploys as there is some down time in between)

yeah these are legit concerns. if that's the case, a 'Sync with Blockchain' button might not be feasible.

@frankchen07 thanks for investigating! knowing the refresh rate and the actual source of the issue will be really helpful.

not sure if this helps, but here's another related issue regarding bounty syncing and Infura: #2394

tbh I'm suprised that we do not have a callback on the GETH instance.
Usually we should be able to reply events and subscriptions on the geth side and "push them" into our database, if neccessary even resyncing them.
Right now, it looks to me that this is actually the other way around, we're basically polling geth to give us the latest information instead of event-reacting to it:
https://github.com/gitcoinco/web/blob/0c6df031c066954f376ce927d721061bd24ec374/scripts/crontab#L9-L16

Just my 2 WEI.

-Chris

I didn't saw this comments I was going to start #2403 also there is this related discussion #2394 Maybe we need to discuss further and decide what way we want to go.
I also agree if you saw a button to sync you will click it each time you user to explorer hoping to get the lastest so I don't think it need to be an user action any case have to happens in the background (and is already a cron for that)

im thinking we'll want to priroitize https://github.com/gitcoinco/web/issues/2885 to start

Makes sense if there are performance concerns.
cc: @thelostone-mc

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kziemianek picture kziemianek  ·  3Comments

NukeManDan picture NukeManDan  ·  3Comments

Skyge picture Skyge  ·  3Comments

abitrolly picture abitrolly  ·  4Comments

uluhonolulu picture uluhonolulu  ·  3Comments