SnoozyWaffle
SnoozyWaffle

Grapes - Bug

Notification says that I have accumulated 400 grapes, but it's displayed as 388 on home page.

Also, not able to add more than one screenshot to show the home page screenshot

Post image
17mo ago
Talking product sense with Ridhi
9 min AI interview5 questions
Round 1 by Grapevine
PeppyJellybean
PeppyJellybean

This is called caching. Basically, they want to avoid making unnecessary API calls since every request cost them something ( the amount is however not substantial ) . They might be storing this data , let’s say in Redis which is a caching system. It has its predefined Time to live ( TTL ) . Once the TTL is expired , only then API call is made again and hence you see the delay in updating the grapes in home page.

Notification is independent of this concept

SnoozyPotato
SnoozyPotato

This is on client side so redis is not the issue or even something to discuss here, gcp, aws, azure everyone charges for egress and they want to reduce this as much as possible hence the caching on client side. A better approach would have been a background thread which makes this API call in some duration and updates the object store, the rest pages can use this information. A properly defined schema to fetch current grapes will be in 2 digit ms, this is not a youtube hitcounter which is updating every ms

PeppyJellybean
PeppyJellybean

Makes sense. I like the approach that you specified

SnoozyPotato
SnoozyPotato

Go to your profile and come back to feed it will sync, looks like its cached and the API call only happens when visiting the profile page, the notifications is independent of the state of the value cached in feed page hence the old value

SnoozyWaffle
SnoozyWaffle

thanks....this worked

WigglyMuffin
WigglyMuffin

Need some more grapes

JumpyWaffle
JumpyWaffle

Sorry it takes some time to refresh up

ZestyNarwhal
ZestyNarwhal
Meesho17mo

Eventual consistency bro

Discover more
Curated from across