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

featuredが年越しのタイミングで多分壊れる #12486

Closed
anatawa12 opened this issue Nov 28, 2023 · 0 comments · Fixed by #12567
Closed

featuredが年越しのタイミングで多分壊れる #12486

anatawa12 opened this issue Nov 28, 2023 · 0 comments · Fixed by #12567
Labels
🐛Bug Unexpected behavior packages/backend Server side specific issue/PR

Comments

@anatawa12
Copy link
Member

💡 Summary

featuredが年越しのタイミングで多分壊れます。

時間をいじるのが面倒なので実際のコードではテストしていないですがnode replではある程度確認しました。

private getCurrentWindow(windowRange: number): number {
const passed = new Date().getTime() - new Date(new Date().getFullYear(), 0, 1).getTime();
return Math.floor(passed / windowRange);
}

こちらでgetCurrentWindowは元旦からの日数が計算されています。そのため、元旦から三日間程度はwindowがおそらく0になります。

const currentWindow = this.getCurrentWindow(windowRange);
const previousWindow = currentWindow - 1;

getRankingOfではcurrentWindow-1を使用しているので-1になってしまうと思うのですが、実際にデータが入ってるのは末尾(Globalは121)のwindowになると思います。このため年越し直後はfeaturedの該当noteがなくなると考えられます。

🥰 Expected Behavior

年越し後も年越し前のnoteがfeaturedに載る

🤬 Actual Behavior

年越し後も年越し前のnoteがfeaturedに多分乗らない

📝 Steps to Reproduce

たぶんサーバー実行PCの時間を変えると再現できますが未確認です。

💻 Frontend Environment

* Model and OS of the device(s):
* Browser:
* Server URL:
* Misskey:

🛰 Backend Environment (for server admin)

* Installation Method or Hosting Service:
* Misskey:
* Node:
* PostgreSQL:
* Redis:
* OS and Architecture:
@anatawa12 anatawa12 added the ⚠️bug? This might be a bug label Nov 28, 2023
@syuilo syuilo added 🐛Bug Unexpected behavior packages/backend Server side specific issue/PR and removed ⚠️bug? This might be a bug labels Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛Bug Unexpected behavior packages/backend Server side specific issue/PR
Projects
None yet
2 participants