fix(archied): stop retrying task outcomes for a channel messaging does not have

This commit is contained in:
sam committed 2026-10-24 17:02:50 +11:00
1 parent 793569f6e1
commit 9a08048744
4 files changed
+65 -3

No files matched your search

@@ -20,9 +20,13 @@ import (
)
// ErrUnavailable marks a delivery the channel could not make now: the channel
// is unknown, stopped or cannot send. The caller may retry later.
// is stopped or cannot send. The caller may retry later.
var ErrUnavailable = errors.New("messaging: channel unavailable")
// ErrNoChannel marks a delivery to a channel this service does not have.
// Retrying cannot succeed.
var ErrNoChannel = errors.New("messaging: no such channel")
// Deliverer sends text to one chat on a named channel.
type Deliverer interface {
Deliver(ctx context.Context, channel, chatID, text string) error
@@ -47,6 +51,8 @@ func (s *server) Deliver(ctx context.Context, req *pb.DeliverRequest) (*pb.Deliv
switch {
case err == nil:
return &pb.DeliverResponse{}, nil
case errors.Is(err, ErrNoChannel):
return nil, status.Error(codes.NotFound, err.Error())
case errors.Is(err, ErrUnavailable):
return nil, status.Error(codes.FailedPrecondition, err.Error())
default: