fix: database lock by adding lock function when set schedule
Some checks failed
/ push (push) Has been cancelled
Some checks failed
/ push (push) Has been cancelled
This commit is contained in:
parent
c114469721
commit
0c784b4cc9
|
@ -96,6 +96,7 @@ func (api *API) PubsubStartDownloadSubreddit(ctx context.Context, params PubsubS
|
||||||
return errs.Wrapw(err, "failed to verify subreddit existence", "params", params)
|
return errs.Wrapw(err, "failed to verify subreddit existence", "params", params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
api.lockf(func() {
|
||||||
err = api.withTransaction(ctx, func(exec bob.Executor) error {
|
err = api.withTransaction(ctx, func(exec bob.Executor) error {
|
||||||
_, err := api.scheduleSet(ctx, exec, ScheduleSetParams{
|
_, err := api.scheduleSet(ctx, exec, ScheduleSetParams{
|
||||||
Subreddit: subreddit.Name,
|
Subreddit: subreddit.Name,
|
||||||
|
@ -116,6 +117,7 @@ func (api *API) PubsubStartDownloadSubreddit(ctx context.Context, params PubsubS
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue