Skip to content
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

TrendTagSchedulerの実行後、トレンドタグのWebUIを自動更新するように変更 #147

Merged
merged 2 commits into from
Mar 8, 2018

Conversation

takayamaki
Copy link
Member

TrendTagSchedulerの実行後、command streamを通じてトレンドタグのWebUIを自動更新するように変更しました。

通信不良などによりメッセージが届かなかった、または更新に失敗した時のために手動更新ボタンも残しています。

@takayamaki takayamaki requested review from fvh-P and lnanase March 6, 2018 18:25
@fvh-P
Copy link
Collaborator

fvh-P commented Mar 7, 2018

setPolling = () => {
this.cancelPolling();
const now = new Date();
const min = now.getMinutes();
const sec = now.getSeconds();
let timeout = (610 - ((min + 5) % 10 * 60 + sec)) % 600 * 1000;
if (timeout === 0) {
timeout = 600 * 1000;
}
this.timer = setTimeout(this.refresh, timeout);
}
cancelPolling = () => {
if (this.timer !== null) {
clearTimeout(this.timer);
this.timer = null;
}
}
refresh = () => {
this.cancelPolling();
this.props.refreshTrendTags();
}

もしかしてこの辺のPollingとか全部要らなくなる感じですか

@takayamaki
Copy link
Member Author

あー、websocketを信頼するなら要らなくなりますね
(ポーリングが存在してたことをすっかり失念していた)

まあwebsocketが正しく動作していない場合ってそれ要するにWebUIまともに使えないということを意味するので、ポーリング削除するcommitつくります

Copy link
Collaborator

@fvh-P fvh-P left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確認しました。
こんなやり方があったとは…

@takayamaki
Copy link
Member Author

このcommand Websocketは #131 でfriends.nicoから輸入した動的お知らせの機能の一部なので知らなくてもしかたない

@takayamaki takayamaki merged commit 3cb399c into imas:imastodon Mar 8, 2018
@takayamaki takayamaki deleted the trend-tags-ui-auto-reload branch March 8, 2018 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants