Skip to content

Commit

Permalink
Merge pull request #6 from Minehut/multiple-lifecycle-expirations
Browse files Browse the repository at this point in the history
Updating lifecycle expired value
  • Loading branch information
rayjanoka authored Sep 13, 2024
2 parents 8c354b6 + c8d4a6b commit e75e104
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion archie/removeObject.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import (
"context"
"github.com/nats-io/nats.go"
"github.com/rs/zerolog"
"golang.org/x/exp/slices"
"time"
)

func (a *Archiver) removeObject(ctx context.Context, mLog zerolog.Logger, eventObjKey string, msg *nats.Msg, record event.Record) (error, string, AckType) {
metadata, _ := msg.Metadata()

if a.SkipLifecycleExpired && (record.Source.Host == "Internal: [ILM-EXPIRY]" || record.Source.UserAgent == "Internal: [ILM-EXPIRY]") {
lifecycleExpirations := []string{"Internal: [ILM-EXPIRY]", "Internal: [ILM-Expiry]"}

if a.SkipLifecycleExpired && (slices.Contains(lifecycleExpirations, record.Source.Host) || slices.Contains(lifecycleExpirations, record.Source.UserAgent)) {
mLog.Info().
Uint64("numDelivered", metadata.NumDelivered).
Str("queueDuration", time.Now().Sub(metadata.Timestamp).String()).
Expand Down

0 comments on commit e75e104

Please sign in to comment.