-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue/#19 #50
Issue/#19 #50
Conversation
pkg/dkwatcher/dkwatcher.go
Outdated
nextTalk, err := track.Talks.GetNextTalk() | ||
if err != nil { | ||
logger.Info("nextTalk is none") | ||
continue | ||
} | ||
if !track.Talks.IsStartNextTalkSoon(howManyMinutesUntilNotify) { | ||
logger.Info("nextTalk is not start soon. trackNo:%s", track.Id) | ||
continue | ||
} | ||
val, err := redisClient.GetNextTalkNotification(ctx, int(nextTalk.Id)) | ||
if err != nil { | ||
logger.Error(xerrors.Errorf("message: %w", err), "db.GetNextTalkNotification() was failed") | ||
return err | ||
} | ||
if val != "" { | ||
logger.Info("nextTalkNotification already sent . trackNo:%s", track.Id) | ||
continue | ||
} | ||
currentTalk, err := track.Talks.GetCurrentTalk() | ||
if err != nil { | ||
logger.Info("currentTalk is none") | ||
currentTalk = &model.Talk{} | ||
} | ||
if err := mw.SetTrack(track); err != nil { | ||
logger.Error(xerrors.Errorf("message: %w", err), "mw.SetTrack was failed") | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dreamkast から取得してきたデータはまず mw に保存して、それから dkwatcher -> notifier に通知するかを判断するべきです。(でないと obswatcher が古いタイムテーブルを見続ける可能性があるため)
そのため、mw.SetTrack()
を 108 行目に移動してもらえますか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。確かに先にmwに保存するべきですね。
f7dd3c1
pkg/dkwatcher/dkwatcher.go
Outdated
val, err := redisClient.GetNextTalkNotification(ctx, int(nextTalk.Id)) | ||
if err != nil { | ||
logger.Error(xerrors.Errorf("message: %w", err), "db.GetNextTalkNotification() was failed") | ||
return err | ||
} | ||
if val != "" { | ||
logger.Info("nextTalkNotification already sent . trackNo:%s", track.Id) | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nits なので直さなくて問題ないです)
- ここで取り出す val は early return するかどうかの判断以外に利用しないので、以下のようにスコープを閉じてしまう書き方をするほうが自分は好きです (val をここ以外で利用しないことが明確になるため)
if val, err := redisClient.GetNextTalkNotification(ctx, int(nextTalk.Id)); err != nil {
logger.Error(xerrors.Errorf("message: %w", err), "db.GetNextTalkNotification() was failed")
return err
} else if val != "" {
logger.Info("nextTalkNotification already sent . trackNo:%s", track.Id)
continue
}
PR 出しました、確認お願いします #55 |
ありがとうございます、mergeさせていただきました |
ref: #19