mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-19 05:58:08 +03:00
fix(sync): batch inserts + normalize nulls to avoid SQLite param mismatch
- Batch repository inserts with dynamic sizing under SQLite 999-param limit - Normalize undefined → null to keep multi-row insert shapes consistent - De-duplicate owned + starred repos by fullName (prefer starred variant) - Enforce uniqueness via (user_id, full_name) + onConflictDoNothing - Handle starred name collisions (suffix/prefix) across mirror + metadata - Add repo-utils helpers + tests; guard Octokit.plugin in tests - Remove manual unique index from entrypoint; rely on drizzle-kit migrations
This commit is contained in:
@@ -18,8 +18,11 @@ if (process.env.NODE_ENV !== "test") {
|
||||
}
|
||||
}
|
||||
|
||||
// Extend Octokit with throttling plugin
|
||||
const MyOctokit = Octokit.plugin(throttling);
|
||||
// Extend Octokit with throttling plugin when available (tests may stub Octokit)
|
||||
// Fallback to base Octokit if .plugin is not present
|
||||
const MyOctokit: any = (Octokit as any)?.plugin?.call
|
||||
? (Octokit as any).plugin(throttling)
|
||||
: Octokit as any;
|
||||
|
||||
/**
|
||||
* Creates an authenticated Octokit instance with rate limit tracking and throttling
|
||||
|
||||
Reference in New Issue
Block a user