Skip to content

Commit cf7ceb5

Browse files
authored
fix: reduce chances of install timing out (#171)
* fix: reduce chances of install timing out * handle review comments
1 parent ae39c5a commit cf7ceb5

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

packages/sync-engine/src/supabase/supabase.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,23 @@ export class SupabaseSetupClient {
551551
await this.setupSigmaPgCronJob()
552552
}
553553

554+
// Set the comment status to installed here before invoking stripe-worker
555+
// edge function because the installation is effectively done at this time
556+
await this.updateComment({ status: 'installed', oldVersion })
557+
554558
// Invoke stripe-worker immediately to trigger first sync for better UX on Supabase
555559
// dashboard. We want to see the first sync run immediately after an installation.
556-
await this.invokeFunction('stripe-worker', 'POST', this.workerSecret)
557-
558-
// Set final version comment
559-
await this.updateComment({ status: 'installed', oldVersion })
560+
// This is done after marking the installation as completed in the comment because
561+
// running the `stripe-worker` might take some time and timeout the actual installation
562+
// if done before. This is fine because even if this invocation fails for some reason
563+
// the installation is still completed and this is invoked on a best effort basis
564+
// to improve UX.
565+
try {
566+
await this.invokeFunction('stripe-worker', 'POST', this.workerSecret)
567+
} catch (error) {
568+
const errorMessage = error instanceof Error ? error.message : String(error)
569+
console.warn(`Failed to invoke stripe-worker: ${errorMessage}`)
570+
}
560571
} catch (error) {
561572
const errorMessage = error instanceof Error ? error.message : String(error)
562573
try {

0 commit comments

Comments
 (0)