fleet/server/pubsub/errors.go
Martin Angers 6c0e56ea73
Address multiple redis-related issues observed with live queries (#16855)
#16331 

Doc updates in a separate PR:
https://github.com/fleetdm/fleet/pull/17214

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality (smoke-tested locally
with osquery-perf simulating 100 hosts, ran a live query, a saved live
query, stopped naturally and stopped before the end, and again via
fleetctl)

---------

Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
Co-authored-by: Victor Lyuboslavsky <victor.lyuboslavsky@gmail.com>
2024-02-27 19:35:27 -06:00

25 lines
681 B
Go

// Package pubsub implements pub/sub interfaces defined in package fleet.
package pubsub
// Error defines the interface of errors specific to the pubsub package
type Error interface {
error
// NoSubscriber returns true if the error occurred because there are no
// subscribers on the channel
NoSubscriber() bool
}
// NoSubscriberError can be returned when channel operations fail because there
// are no subscribers. Its NoSubscriber() method always returns true.
type noSubscriberError struct {
Channel string
}
func (e noSubscriberError) Error() string {
return "no subscriber for channel " + e.Channel
}
func (e noSubscriberError) NoSubscriber() bool {
return true
}