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

fix: remove repetitive quota refresh interval #180

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eddsi
Copy link

@eddsi eddsi commented Apr 29, 2024

Description:

Summary

This pull request addresses the issue of unnecessary repetitive quota and subscription refresh intervals in our codebase. By removing the redundant setInterval calls, we optimize performance and reduce potential overhead caused by frequent state updates.

Changes

  • Removed the setInterval function that triggers refreshQuota(dispatch) every 5000 milliseconds.
  • Removed the setInterval function that triggers refreshSubscription(dispatch) every 10000 milliseconds.

Impact

  • Performance Improvement: These changes reduce the load on our servers by decreasing the frequency of state updates, which can significantly improve the responsiveness of our application.
  • Code Simplicity: Eliminates unnecessary complexity and potential sources of bugs related to state management in high-frequency update scenarios.

Tests

  • Local Testing: Ensured that the application's functionality remains stable and both the quota and subscription refresh mechanisms work as expected without the setInterval calls.
  • Unit Tests: All related unit tests have been updated to reflect these changes and are passing.

Please review the changes and merge them if everything is in order. Feel free to ask for any further modifications if needed.

描述:

概述

此 Pull Request 解决了我们代码库中不必要的重复配额与订阅刷新间隔问题。通过移除多余的 setInterval 调用,我们优化了性能并减少了因频繁状态更新可能造成的开销。

更改内容

  • 移除了每5000毫秒触发 refreshQuota(dispatch)setInterval 函数。
  • 移除了每10000毫秒触发 refreshSubscription(dispatch)setInterval 函数。

影响

  • 性能提升: 这些更改通过减少状态更新的频率,减轻了服务器的负担,这可以显著提升我们应用的响应速度。
  • 代码简化: 消除了与高频更新场景中状态管理相关的不必要复杂性和潜在错误源。

测试

  • 本地测试: 确保应用的功能保持稳定,并且配额与订阅刷新机制在没有 setInterval 调用的情况下按预期工作。
  • 单元测试: 所有相关单元测试已更新以反映这些更改,并且均通过测试。

请审查更改,并在一切无误时合并它们。如果需要进行任何进一步的修改,请随时提出。

Copy link

vercel bot commented Apr 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chatnio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2024 9:12am

@zmh-program
Copy link
Member

非常感谢 PR。此问题减少了轮询请求订阅和点数请求的方案,替换为事件响应,目前因为还有其他地方也使用useSelector引用了quota, subscriptionData的信息,这些引用没有被出发更新请求事件,可能会导致显示错误,需要再增加补丁。等我忙完这段时间之后,改进此 PR 并 merge。

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.

None yet

2 participants