refactor: remove automatic background incremental sync
Garmin's rate-limiting means every unattended sync attempt risks a ban; syncing should only ever happen when explicitly triggered via "Sync now" (POST /api/sync/run), never on an unattended timer. Removes the periodic background loop (main.go's runIncrementalSyncLoop, api.Server.RunIncrementalSyncForAllUsers), its GENIUSRUN_INCREMENTAL_SYNC_EVERY config, and store.DB.ListUsers (which existed solely to feed it). The manual "Sync now" flow (Backfill/IncrementalSync/FillPendingDetails via FullSync) is untouched.
This commit is contained in:
@@ -32,26 +32,6 @@ func (db *DB) GetUserBySub(ctx context.Context, oidcSub string) (User, bool, err
|
||||
return u, true, nil
|
||||
}
|
||||
|
||||
// ListUsers returns every provisioned user, for the background incremental
|
||||
// sync loop to iterate.
|
||||
func (db *DB) ListUsers(ctx context.Context) ([]User, error) {
|
||||
rows, err := db.QueryContext(ctx, `SELECT id, oidc_sub, display_name, created_at FROM users ORDER BY id`)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("list users: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
users := []User{}
|
||||
for rows.Next() {
|
||||
var u User
|
||||
if err := rows.Scan(&u.ID, &u.OIDCSub, &u.DisplayName, &u.CreatedAt); err != nil {
|
||||
return nil, fmt.Errorf("scan user row: %w", err)
|
||||
}
|
||||
users = append(users, u)
|
||||
}
|
||||
return users, rows.Err()
|
||||
}
|
||||
|
||||
// neverMatchRule is the placeholder every fresh install's rule-engine kinds
|
||||
// start with -- every activity lands in needs_review until the user tunes
|
||||
// real rules.
|
||||
|
||||
Reference in New Issue
Block a user