mirror of
https://github.com/community-unscripted/telemetry-service.git
synced 2026-07-01 20:54:03 -04:00
fix: URL-encode filter in FindRecordByRandomID, reduce stuck timeout to 1h
- FindRecordByRandomID now uses url.QueryEscape for PocketBase filter - CLEANUP_STUCK_HOURS default lowered from 2 to 1 for faster recovery - Add go-sqlite3 dependency (for bootstrap tooling)
This commit is contained in:
@@ -7,4 +7,5 @@ require github.com/redis/go-redis/v9 v9.17.3
|
||||
require (
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.34 // indirect
|
||||
)
|
||||
|
||||
@@ -6,5 +6,7 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/mattn/go-sqlite3 v1.14.34 h1:3NtcvcUnFBPsuRcno8pUtupspG/GM+9nZ88zgJcp6Zk=
|
||||
github.com/mattn/go-sqlite3 v1.14.34/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/redis/go-redis/v9 v9.17.3 h1:fN29NdNrE17KttK5Ndf20buqfDZwGNgoUr9qjl1DQx4=
|
||||
github.com/redis/go-redis/v9 v9.17.3/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370=
|
||||
|
||||
+3
-3
@@ -254,11 +254,11 @@ func (p *PBClient) FindRecordByRandomID(ctx context.Context, randomID string) (s
|
||||
return "", err
|
||||
}
|
||||
|
||||
// URL encode the filter
|
||||
// URL encode the filter to ensure special characters are handled correctly
|
||||
filter := fmt.Sprintf("random_id='%s'", randomID)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet,
|
||||
fmt.Sprintf("%s/api/collections/%s/records?filter=%s&fields=id&perPage=1",
|
||||
p.baseURL, p.targetColl, filter),
|
||||
p.baseURL, p.targetColl, url.QueryEscape(filter)),
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -1058,7 +1058,7 @@ func main() {
|
||||
cleaner := NewCleaner(CleanupConfig{
|
||||
Enabled: envBool("CLEANUP_ENABLED", true),
|
||||
CheckInterval: time.Duration(envInt("CLEANUP_INTERVAL_MIN", 15)) * time.Minute,
|
||||
StuckAfterHours: envInt("CLEANUP_STUCK_HOURS", 2),
|
||||
StuckAfterHours: envInt("CLEANUP_STUCK_HOURS", 1),
|
||||
RetentionEnabled: envBool("RETENTION_ENABLED", false),
|
||||
RetentionDays: envInt("RETENTION_DAYS", 365),
|
||||
}, pb)
|
||||
|
||||
Reference in New Issue
Block a user