Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[ENHANCEMENT] Standardize Error Handling in Event Producer to Enable Retries and Filter Poison Pills

Aperta
#2,124 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go

Direzione di ricerca

Leggi ProcessSearch in workers/event_producer/pkg/producer/producer.go e il comportamento ACK/NACK in lib/gcppubsub/client.go. Segui gli errori degli adapter Spanner e GCS, quindi esamina gli errori sentinel proposti in lib/workertypes/errors.go. Il lavoro è completato quando gli errori transitori del database, dello storage e di Differ vengono ritentati, mentre le entità mancanti e i dati non validi vengono riconosciuti senza ritentare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Description:
Currently, the ProcessSearch function in the Event Producer (workers/event_producer/pkg/producer/producer.go) only wraps errors from AcquireLock with event.ErrTransientFailure. All other errors (Database reads/writes, GCS operations, external API calls) are returned as standard errors.

The Problem:
The Pub/Sub subscriber adapter is configured to ACK (drop) any message where the handler returns a non-transient error. This means that a temporary network glitch (e.g., Spanner read timeout, GCS 503) will cause the notification job to be permanently lost instead of retried.

https://github.com/GoogleChrome/webstatus.dev/blob/04a94439ffd32f583caa05143a215a0cf748ffac/lib/gcppubsub/client.go#L68-L82

Conversely, simply wrapping all errors as transient would cause "poison pills" (e.g., invalid Saved Search IDs) to loop infinitely.

Objective:
We need to implement a robust error handling strategy that retries by default (to catch network issues) but fails fast on known invalid states.

Proposed Changes:

  1. Define Standard Errors: Create lib/workertypes/errors.go to define sentinel errors for adapters:
  • var ErrEntityNotFound = errors.New("entity not found")
  • var ErrInvalidData = errors.New("invalid data format")
  1. Update Adapters: Modify Spanner and GCS adapters to return these specific errors where appropriate (e.g., GetLatestEvent returning ErrEntityNotFound if the search ID is invalid).
  2. Update ProcessSearch Logic: Refactor error handling in ProcessSearch to follow this pattern:
  • Permanent Failure Check: If the error matches workertypes.ErrEntityNotFound or workertypes.ErrInvalidData, return it directly (triggering an ACK/Drop).
  • Transient Default: For all other errors (unknown or network-related), wrap them with event.ErrTransientFailure (triggering a NACK/Retry).

Acceptance Criteria:

  • Transient failures (network blips) in DB, Storage, or Differ now trigger a retry (NACK).
  • Permanent failures (missing search ID, bad data) trigger an immediate failure (ACK) and are not retried.
Lingua principale
Go
Stelle
255
Fork
62
Merge medio
1g 10h
PR unite (30g)
49

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GoogleChrome/webstatus.dev

Tutte le issue di GoogleChrome/webstatus.dev

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.