Skip to content

Conversation

@arpandhakal
Copy link
Collaborator

Changes

  • created an api that list the failed to upload records from file_folder_sync table and retry the sync. Condition: where object = 'file' and content_hash is null.
  • created a cron job that tries to sync the failed records.
  • All the failed syncs are on assembly files, so the api only does that now.

@arpandhakal arpandhakal self-assigned this Feb 5, 2026
@linear
Copy link

linear bot commented Feb 5, 2026

@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dropbox-integration Ready Ready Preview, Comment Feb 9, 2026 7:29am

Request Review

Comment on lines 35 to 38
await resyncFailedFilesInAssembly.trigger({
portalId,
failedSyncs: failedSyncsForPortal,
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we okay with all these jobs being run in parallel? Like, we won't get ratelimited by Assembly or Dbx side?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job is calling a service where bottleneck is applied for parallel processing. Also, there aren't much files that are failing, so its safe to let things pass for now.

SandipBajracharya

This comment was marked as off-topic.

export const resyncFailedFiles = async (request: NextRequest) => {
const authHeader = request.headers.get('authorization')
if (authHeader !== `Bearer ${env.CRON_SECRET}`) {
throw new APIError('Unauthorized', 401)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use httpStatus.UNAUTHORIZED here for consistency?

},
})

export const resyncFailedFilesInAssembly = task({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also consider defining machine here since single portal could have many files and can be long running as well. We have TRIGGER_MACHINE env that you can import from server.env.ts file and use that here.


for (const portalId in failedSyncWorkspaceMap) {
const failedSyncsForPortal = failedSyncWorkspaceMap[portalId]
await resyncFailedFilesInAssembly.trigger({
Copy link
Collaborator

@SandipBajracharya SandipBajracharya Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the intention is to await for the trigger task here, it won't work. This is the nature of the task unless we do triggerAndWait which can only be done from another trigger task.

@arpandhakal arpandhakal merged commit 54f581d into main Feb 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants