Skip to content

Commit 5c13ec3

Browse files
committed
Fix lint after rebasing PR Wei-Shaw#938 branch
1 parent d8aff3a commit 5c13ec3

1 file changed

Lines changed: 0 additions & 76 deletions

File tree

backend/internal/repository/account_repo.go

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,82 +1240,6 @@ func isSchedulerNeutralExtraKey(key string) bool {
12401240
return false
12411241
}
12421242

1243-
func shouldSyncSchedulerSnapshotForExtraUpdates(updates map[string]any) bool {
1244-
return codexExtraIndicatesRateLimit(updates, "7d") || codexExtraIndicatesRateLimit(updates, "5h")
1245-
}
1246-
1247-
func codexExtraIndicatesRateLimit(updates map[string]any, window string) bool {
1248-
if len(updates) == 0 {
1249-
return false
1250-
}
1251-
usedValue, ok := updates["codex_"+window+"_used_percent"]
1252-
if !ok || !extraValueIndicatesExhausted(usedValue) {
1253-
return false
1254-
}
1255-
return extraValueHasResetMarker(updates["codex_"+window+"_reset_at"]) ||
1256-
extraValueHasPositiveNumber(updates["codex_"+window+"_reset_after_seconds"])
1257-
}
1258-
1259-
func extraValueIndicatesExhausted(value any) bool {
1260-
number, ok := extraValueToFloat64(value)
1261-
return ok && number >= 100-1e-9
1262-
}
1263-
1264-
func extraValueHasPositiveNumber(value any) bool {
1265-
number, ok := extraValueToFloat64(value)
1266-
return ok && number > 0
1267-
}
1268-
1269-
func extraValueHasResetMarker(value any) bool {
1270-
switch v := value.(type) {
1271-
case string:
1272-
return strings.TrimSpace(v) != ""
1273-
case time.Time:
1274-
return !v.IsZero()
1275-
case *time.Time:
1276-
return v != nil && !v.IsZero()
1277-
default:
1278-
return false
1279-
}
1280-
}
1281-
1282-
func extraValueToFloat64(value any) (float64, bool) {
1283-
switch v := value.(type) {
1284-
case float64:
1285-
return v, true
1286-
case float32:
1287-
return float64(v), true
1288-
case int:
1289-
return float64(v), true
1290-
case int8:
1291-
return float64(v), true
1292-
case int16:
1293-
return float64(v), true
1294-
case int32:
1295-
return float64(v), true
1296-
case int64:
1297-
return float64(v), true
1298-
case uint:
1299-
return float64(v), true
1300-
case uint8:
1301-
return float64(v), true
1302-
case uint16:
1303-
return float64(v), true
1304-
case uint32:
1305-
return float64(v), true
1306-
case uint64:
1307-
return float64(v), true
1308-
case json.Number:
1309-
parsed, err := v.Float64()
1310-
return parsed, err == nil
1311-
case string:
1312-
parsed, err := strconv.ParseFloat(strings.TrimSpace(v), 64)
1313-
return parsed, err == nil
1314-
default:
1315-
return 0, false
1316-
}
1317-
}
1318-
13191243
func (r *accountRepository) BulkUpdate(ctx context.Context, ids []int64, updates service.AccountBulkUpdate) (int64, error) {
13201244
if len(ids) == 0 {
13211245
return 0, nil

0 commit comments

Comments
 (0)