Skip to content

Commit

Permalink
refactor: Removing useless goroutine
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Mar 12, 2023
1 parent 7fde2cd commit 503f101
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/webhook/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ func (a *App) EventConsumer(ctx context.Context, event provider.Event) {
switch webhook.Kind {
case provider.Raw:
statusCode, err = a.rawHandle(ctx, webhook, event)

case provider.Discord:
statusCode, err = a.discordHandle(ctx, webhook, event)

case provider.Slack:
statusCode, err = a.slackHandle(ctx, webhook, event)

case provider.Telegram:
statusCode, err = a.telegramHandle(ctx, webhook, event)

default:
logger.Warn("unknown kind `%d` for webhook", webhook.Kind)
}
Expand All @@ -51,13 +55,11 @@ func (a *App) EventConsumer(ctx context.Context, event provider.Event) {
}
}

go func() {
if event.Type == provider.DeleteEvent {
if err := a.deleteItem(ctx, event.Item); err != nil {
logger.Error("delete webhooks for item: %s", err)
}
if event.Type == provider.DeleteEvent {
if err := a.deleteItem(ctx, event.Item); err != nil {
logger.Error("delete webhooks for item: %s", err)
}
}()
}
}

func send(ctx context.Context, id string, req request.Request, payload any) (int, error) {
Expand Down

0 comments on commit 503f101

Please sign in to comment.