Home / Function/ updateSuccessfulChecksums() — supabase Function Reference

updateSuccessfulChecksums() — supabase Function Reference

Architecture documentation for the updateSuccessfulChecksums() function in generate-embeddings.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  b25b1a95_6c17_3fe0_4b09_200b434c8c1e["updateSuccessfulChecksums()"]
  b280bae5_b0f6_6775_91cb_d0697bd4d074["generateEmbeddings()"]
  b280bae5_b0f6_6775_91cb_d0697bd4d074 -->|calls| b25b1a95_6c17_3fe0_4b09_200b434c8c1e
  94c6fd9e_4273_b489_8fb9_0054d6d1c1ce["createBatches()"]
  b25b1a95_6c17_3fe0_4b09_200b434c8c1e -->|calls| 94c6fd9e_4273_b489_8fb9_0054d6d1c1ce
  style b25b1a95_6c17_3fe0_4b09_200b434c8c1e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/scripts/search/generate-embeddings.ts lines 523–563

async function updateSuccessfulChecksums(
  supabaseClient: SupabaseClient,
  pageTable: string,
  pageInfoMap: Map<number, PageInfo>,
  processingResult: ProcessingResult
): Promise<number> {
  let successfulChecksumUpdates = 0
  const pageIds = Array.from(processingResult.successfulPages)
  const batches = createBatches(pageIds, CONFIG.SOURCE_CONCURRENCY)

  for (const batch of batches) {
    const results = await Promise.all(
      batch.map(async (pageId) => {
        const pageInfo = pageInfoMap.get(pageId)
        if (!pageInfo) {
          console.error(`Missing page info for pageId ${pageId}`)
          return 0
        }

        try {
          const { error: updatePageError } = await supabaseClient
            .from(pageTable)
            .update({ checksum: pageInfo.checksum })
            .eq('id', pageId)
          if (updatePageError) {
            console.error(`Failed to update checksum for page ${pageInfo.path}:`, updatePageError)
            return 0
          }
          return 1
        } catch (error) {
          console.error(`Error updating checksum for page ${pageInfo.path}:`, error)
          return 0
        }
      })
    )

    successfulChecksumUpdates += results.reduce((sum, x) => sum + x, 0)
  }

  return successfulChecksumUpdates
}

Subdomains

Frequently Asked Questions

What does updateSuccessfulChecksums() do?
updateSuccessfulChecksums() is a function in the supabase codebase.
What does updateSuccessfulChecksums() call?
updateSuccessfulChecksums() calls 1 function(s): createBatches.
What calls updateSuccessfulChecksums()?
updateSuccessfulChecksums() is called by 1 function(s): generateEmbeddings.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free