Open schottra opened 1 day ago
Latest commit: c6846916530578302515d682051fae9b3f7a2832
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Preview this change https://demo.audius.co/pay-3388-implement-client-v1-feed
Description
This is an updated version of #9593 . Now that SDK can load and make requests before libs has finished initializing, we can re-enable the migrated feed endpoint. There was an additional change necessary for web to remove a
waitForLibsInit
from the SDK initialization function. It was meant to prevent apiClient from making requests too soon. But we've now removed all but one request from apiClient and it's unlikely (not possible?) for it to be called during app initialization.BONUS FIX: There was a strange concurrency issue with logging in < 60 seconds after loading the page where a race condition would cause us to think that the previously cached SDK request signature was still valid. This was due to the fact that many requests could be in the check/update flow simultaneously and flip the "current address" and signature value back and forth such that we end up with a signature that wasn't actually generated by the current wallet but remains cached for the next 60 seconds. This would cause the feed to fail to load with a 401 since the generated wallet we use while signed out won't map to a user. It would also apply to any other requests which require a signature (chats, notifications, etc) for 60 seconds after login.
Yikes.
The fix was to use a promise to gate checking/updating of the value to a single instance at a time, with all queued requests afterwards just reading the result.
How Has This Been Tested?
Tested locally against staging and on a prod subdomain. The time to make the initial /feed request did not differ significantly from current prod. (1.25-3 seconds depending on initial page load time)