Skip to content

Commit

Permalink
Merge pull request #362 from ripienaar/408_header
Browse files Browse the repository at this point in the history
Handle 408 header in stream pager
  • Loading branch information
ripienaar authored Mar 11, 2022
2 parents 3ad1ee8 + 95a2374 commit de5ac8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/dustin/go-humanize v1.0.0
github.com/google/go-cmp v0.5.7
github.com/klauspost/compress v1.14.4
github.com/nats-io/nats-server/v2 v2.7.4-0.20220307014317-24067d7374e2
github.com/nats-io/nats.go v1.13.1-0.20220301214049-00e125402ae9
github.com/nats-io/nats-server/v2 v2.7.5-0.20220309212130-5c0d1999ff72
github.com/nats-io/nats.go v1.13.1-0.20220308171302-2f2f6968e98d
github.com/nats-io/nuid v1.0.1
)
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA
github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296 h1:vU9tpM3apjYlLLeY23zRWJ9Zktr5jp+mloR942LEOpY=
github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k=
github.com/nats-io/nats-server/v2 v2.7.4-0.20220307014317-24067d7374e2 h1:rwkh7ZgcLkvVNkGw01jRhPShJ7xzGYAgkG4qUz2bvjE=
github.com/nats-io/nats-server/v2 v2.7.4-0.20220307014317-24067d7374e2/go.mod h1:eJUrA5gm0ch6sJTEv85xmXIgQWsB0OyjkTsKXvlHbYc=
github.com/nats-io/nats.go v1.13.1-0.20220121202836-972a071d373d/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
github.com/nats-io/nats.go v1.13.1-0.20220301214049-00e125402ae9 h1:sW9oM9xrhRakL+vceVHECaV3oCFWP3e1l8Ewy71F/EE=
github.com/nats-io/nats.go v1.13.1-0.20220301214049-00e125402ae9/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
github.com/nats-io/nats-server/v2 v2.7.5-0.20220309212130-5c0d1999ff72 h1:Moe/K4fo/5FCNpE/TYrMt7sEPUuldBVJ0D4g/SWFkd0=
github.com/nats-io/nats-server/v2 v2.7.5-0.20220309212130-5c0d1999ff72/go.mod h1:1vZ2Nijh8tcyNe8BDVyTviCd9NYzRbubQYiEHsvOQWc=
github.com/nats-io/nats.go v1.13.1-0.20220308171302-2f2f6968e98d h1:zJf4l8Kp67RIZhoVeniSLZs69SHNgjLHz0aNsqPPlx8=
github.com/nats-io/nats.go v1.13.1-0.20220308171302-2f2f6968e98d/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
Expand Down
3 changes: 2 additions & 1 deletion stream_pager.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ func (p *StreamPager) NextMsg(ctx context.Context) (msg *nats.Msg, last bool, er
case msg := <-p.q:
p.seen++

if msg.Header.Get("Status") == "404" {
status := msg.Header.Get("Status")
if status == "404" || status == "408" {
return nil, true, fmt.Errorf("last message reached")
}

Expand Down

0 comments on commit de5ac8c

Please sign in to comment.