Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpottier committed Sep 30, 2019
1 parent 197e224 commit f760304
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions models/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ func InsertChildBroadcast(ctx context.Context, db Queryer, parent *Broadcast) (*
child.b.Text.Map = make(map[string]sql.NullString)
for lang, t := range child.b.Translations {
child.b.Text.Map[string(lang)] = sql.NullString{String: t.Text, Valid: true}
if len(t.Attachments) > 0 || len(t.QuickReplies) > 0 {
return nil, errors.Errorf("cannot clone broadcast with quick replies or attachments")
}
}

// insert our broadcast
Expand Down
3 changes: 3 additions & 0 deletions tasks/schedules/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func StartCheckSchedules(mr *mailroom.Mailroom) error {
func(lockName string, lockValue string) error {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5)
defer cancel()
// we sleep 1 second since we fire right on the minute and want to make sure to fire
// things that are schedules right at the minute as well (and DB time may be slightly drifted)
time.Sleep(time.Second * 1)
return checkSchedules(ctx, mr.DB, mr.RP, lockName, lockValue)
},
)
Expand Down

0 comments on commit f760304

Please sign in to comment.