Closed Ipriyankrajai closed 8 months ago
@Ipriyankrajai is attempting to deploy a commit to the Inbox Zero Team on Vercel.
A member of the Team first needs to authorize it.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated (UTC) |
---|---|---|---|
inbox-zero | ✅ Ready (Inspect) | Visit Preview | Jan 10, 2024 5:05pm |
Merge conflict which I fixed here: https://github.com/elie222/inbox-zero/pull/86
Ah. I see it's only sitemap now
Merged here: https://github.com/elie222/inbox-zero/pull/103
Previous conversation here: https://github.com/elie222/inbox-zero/pull/86
POC for better management of bulk tasks.
Motivation
We can get rate limited on the OpenAI API or the Google API. Using
p-queue
we can limit bulk actions to 1 at a time. Ro 3 at a time. And make sure we're below any rate limit thresholds (and also retry failed tasks).Would likely also clean up the codebase a bunch. We could use the same mechanism for bulk and single actions.
Usage
Would be used like so:
Loading State
Probably also want to store the state of a task. So that we know that thread1 and thread2 are
isArchiving: true
. So if we need to show a spinner for a certain row in the UI we can do that. A simple Zustand store might work for this. Reason we'd use Zustand over React Context is that only specific email rows would need to update. With React Context everything would update whenever the store changes. Although could maybe deal with this optimisation later too, and just have a simple useState for it to begin with.Calling Gmail from Client vs Server
ATM, we're calling our server which calls the Gmail API. But really we could call the Gmail API directly if the client has the access token. It's inefficient to call the server API and we'd get faster responses if we called Gmail directly. For archiving an email there's no reason for it to route through our backend. The change will likely be minimal as this code calls server functions, and calling client actions will be the same thing. But I put this here as part of the larger direction to keep in mind. Even if not implementing it today.