Skip to content

Commit

Permalink
fix(trigger.cron): addresses lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptnull committed Mar 5, 2023
1 parent af22f59 commit 8dd5bfa
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions internal/trigger/cron/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,17 @@ func (t *Trigger) Type() trigger.Type {

func (t *Trigger) Register(ctx context.Context) error {
c := cron.New()
c.AddFunc(t.cronExpr, func() {
_, err := c.AddFunc(t.cronExpr, func() {
eventBus := ctx.Value("eventBus").(event.Bus)
eventBus.Publish(fmt.Sprintf("trigger.%s", t.id), []byte{})
t.Do()
})
if err != nil {
return err
}
c.Start()
return nil
}

func (t *Trigger) Do() error {
fmt.Println("Cron trigger Do func called")
return nil
}

func ParseConfig(k *koanf.Koanf) (trigger.Interface, error) {
expression := k.String("expression")
if expression == "" {
Expand Down

0 comments on commit 8dd5bfa

Please sign in to comment.