Skip to content

Silent error swallowing in Enqueue/Len/Values/Purge/Close hides failures #10

Description

@fahimfaisaal

Summary

Several operations swallow errors and return zero-values, so callers cannot distinguish "empty/failed silently" from success. Grouping the low-severity cases here.

Details

a. Enqueue accepts any into a BLOB NOT NULL with no type guard

queue.go:90-115 / priority_queue.go:61-91. item any is passed straight to the driver. Anything that is not []byte/string/numeric fails at the driver and Enqueue returns false with no explanation. The []byte contract is implicit.
Fix: document that item must be []byte (the adapter's contract), or assert/convert and return a typed error.

b. Read/maintenance methods discard errors

  • Len() queue.go:255-263 returns 0 on any error — an errored query looks like an empty queue.
  • Values() queue.go:266-286 returns nil on query error and silently continues on scan error.
  • Purge() queue.go:289-306 and Close() return nothing / drop errors.

Fix: return errors (or at minimum log them) so a failed query is not indistinguishable from an empty queue. If the varmq interface fixes these signatures, add internal logging behind the no-error facade.

Impact

Low individually, but collectively they make failures invisible and debugging hard.

Possible fix

Introduce error-returning internal variants and surface via logging where the public interface cannot change, and tighten the Enqueue contract/documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions