chore: replace interface with any
This commit is contained in:
committed by
Ralf Haferkamp
parent
8f26149743
commit
288e67cc39
@@ -43,7 +43,7 @@ func New(config config.Postprocessing) *Postprocessing {
|
||||
}
|
||||
|
||||
// Init is the first step of the postprocessing
|
||||
func (pp *Postprocessing) Init(_ events.BytesReceived) interface{} {
|
||||
func (pp *Postprocessing) Init(_ events.BytesReceived) any {
|
||||
if len(pp.Steps) == 0 {
|
||||
return pp.finished(events.PPOutcomeContinue)
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func (pp *Postprocessing) Init(_ events.BytesReceived) interface{} {
|
||||
}
|
||||
|
||||
// NextStep returns the next postprocessing step
|
||||
func (pp *Postprocessing) NextStep(ev events.PostprocessingStepFinished) interface{} {
|
||||
func (pp *Postprocessing) NextStep(ev events.PostprocessingStepFinished) any {
|
||||
switch ev.Outcome {
|
||||
case events.PPOutcomeContinue:
|
||||
return pp.next(ev.FinishedStep)
|
||||
@@ -68,7 +68,7 @@ func (pp *Postprocessing) NextStep(ev events.PostprocessingStepFinished) interfa
|
||||
}
|
||||
|
||||
// CurrentStep returns the current postprocessing step
|
||||
func (pp *Postprocessing) CurrentStep() interface{} {
|
||||
func (pp *Postprocessing) CurrentStep() any {
|
||||
if pp.Status.CurrentStep == events.PPStepFinished {
|
||||
return pp.finished(pp.Status.Outcome)
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func (pp *Postprocessing) CurrentStep() interface{} {
|
||||
}
|
||||
|
||||
// Delay will sleep the configured time then continue
|
||||
func (pp *Postprocessing) Delay(f func(next interface{})) {
|
||||
func (pp *Postprocessing) Delay(f func(next any)) {
|
||||
next := pp.next(events.PPStepDelay)
|
||||
go func() {
|
||||
time.Sleep(pp.config.Delayprocessing)
|
||||
@@ -89,7 +89,7 @@ func (pp *Postprocessing) BackoffDuration() time.Duration {
|
||||
return pp.config.RetryBackoffDuration * time.Duration(math.Pow(2, float64(pp.Failures-1)))
|
||||
}
|
||||
|
||||
func (pp *Postprocessing) next(current events.Postprocessingstep) interface{} {
|
||||
func (pp *Postprocessing) next(current events.Postprocessingstep) any {
|
||||
l := len(pp.Steps)
|
||||
for i, s := range pp.Steps {
|
||||
if s == current && i+1 < l {
|
||||
|
||||
@@ -171,7 +171,7 @@ func (pps *PostprocessingService) processEvent(e raw.Event) error {
|
||||
pps.log.Debug().Str("Type", e.Type).Str("ID", e.ID).Msg("processing event received")
|
||||
|
||||
var (
|
||||
next interface{}
|
||||
next any
|
||||
pp *postprocessing.Postprocessing
|
||||
err error
|
||||
)
|
||||
@@ -247,7 +247,7 @@ func (pps *PostprocessingService) processEvent(e raw.Event) error {
|
||||
pps.log.Error().Str("uploadID", ev.UploadID).Err(err).Msg("cannot get upload")
|
||||
return fmt.Errorf("%w: cannot get upload", ErrEvent)
|
||||
}
|
||||
pp.Delay(func(next interface{}) {
|
||||
pp.Delay(func(next any) {
|
||||
if err := events.Publish(ctx, pps.pub, next); err != nil {
|
||||
pps.log.Error().Err(err).Msg("cannot publish event")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user