mirror of
https://github.com/sigmasternchen/threadule
synced 2025-03-15 08:09:01 +00:00
fix: only log errors when an error actually happens
This commit is contained in:
parent
ea4845161c
commit
06042d017c
2 changed files with 10 additions and 3 deletions
|
@ -67,6 +67,7 @@ func (d *Data) GetScheduledThreads() ([]models.Thread, error) {
|
|||
var threads []models.Thread
|
||||
|
||||
err := d.db.
|
||||
Joins("Account").
|
||||
Where("scheduled_for <= ?", time.Now()).
|
||||
Where("status = ?", models.ThreadScheduled).
|
||||
Find(&threads).
|
||||
|
|
|
@ -32,7 +32,9 @@ func (l *Logic) sendTweet(client *twitter.Client, tweet *models.Tweet, prevId in
|
|||
|
||||
tweet.Status = models.TweetDone
|
||||
err = l.ctx.Data.UpdateTweet(tweet)
|
||||
l.ctx.Log.Errorf("couldn't update tweet in DB: %v", err)
|
||||
if err != nil {
|
||||
l.ctx.Log.Errorf("couldn't update tweet in DB: %v", err)
|
||||
}
|
||||
|
||||
return status.ID, nil
|
||||
}
|
||||
|
@ -56,7 +58,9 @@ func (l *Logic) sendThread(thread *models.Thread) {
|
|||
|
||||
thread.Status = models.ThreadProcessing
|
||||
err := l.ctx.Data.UpdateThreadWithoutTweets(thread)
|
||||
l.ctx.Log.Errorf("couldn't update thread in DB: %v", err)
|
||||
if err != nil {
|
||||
l.ctx.Log.Errorf("couldn't update thread in DB: %v", err)
|
||||
}
|
||||
|
||||
tweets, err := l.ctx.Data.GetTweetsForThread(thread)
|
||||
if err != nil {
|
||||
|
@ -101,7 +105,9 @@ func (l *Logic) sendThread(thread *models.Thread) {
|
|||
}
|
||||
|
||||
err = l.ctx.Data.UpdateThreadWithoutTweets(thread)
|
||||
l.ctx.Log.Errorf("couldn't update thread in DB: %v", err)
|
||||
if err != nil {
|
||||
l.ctx.Log.Errorf("couldn't update thread in DB: %v", err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue