-
Notifications
You must be signed in to change notification settings - Fork 0
課題12 sidekiqを導入してキューの永続化を実施 #12
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
base: develop
Are you sure you want to change the base?
Conversation
こういう検証まじいいですね〜!! |
| config.time_zone = 'Asia/Tokyo' | ||
| config.active_record.default_timezone = :local | ||
| config.i18n.default_locale = :ja | ||
| # 実際に非同期処理を行うのはsidekiqで、Active_jobはそのインターフェースを準備してるだけなので、ここでは、どの非同期処理ツールを使うか設定している。 |
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.
👍
| @@ -0,0 +1 @@ | |||
| # 本来なら、ここに本番環境のredis接続先を書かないといけない? No newline at end of file | |||
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.
Yes
| また話が逸れるが、スレッドというのは、プログラムの命令の単位の事で、この命令を複数同時に実行する事を | ||
| マルチスレッドというらしい。調べたけどほとんどわからなかった。 |
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.
スレッドの概念は難しすぎて自分も曖昧です。。。
| `perform_later`と `perfrom_now`の違いは非同期実行かどうかで、非同期実行とはその場で実行するのではなく、重い処理などを | ||
| メソッドが実行された時と別のタイミングで実行する事をいう。[この例をやったらわかりやすかった](https://qiita.com/jnchito/items/3482a30262874b80a8e4) | ||
|
|
||
| ただ重い処理を別タイミングで実行したい場合は、大概、 `perform_later`なのかなと思った。 |
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.
その認識でOK
実施内容
動作確認
非同期実行なので、フォローなどを実施した際に、すぐにメールが送信されない事を確認(処理が終わってから、実行される)
sleep(5)などを入れて、非同期処理が行われているか確認。perform_now同期的だから、数秒待たされるperform_later非同期的に処理するから、待たされないその他
redisの中身などを見て、遊んでみようと思う