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

✨全局计数器 #404

Open
yiliangxiajiao opened this issue Aug 31, 2024 · 4 comments
Open

✨全局计数器 #404

yiliangxiajiao opened this issue Aug 31, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@yiliangxiajiao
Copy link
Contributor

yiliangxiajiao commented Aug 31, 2024

当前不足

考虑以下情景:

  1. 需要打特定副本xx次(如周末120自选)
  2. 需要刷特定物品xx次(如50个小绘卷)

在现有调度器下,2无法实现,1可以实现,但是现在的计数器是基于任务的,如果遇到特殊情况,如程序崩溃、人为中断,计数器就会重置。

解决方案

考虑引入全局计数器机制,计数器分为次数计数器和物品计数器:

  1. 次数计数器:完成特定任务xx次
  2. 物品计数器:在特定页面(如掉落页面)出现特定元素(物品截图)xx次

计数器可配置时间限定,可有以下选择:

  1. 无时间限定
  2. 每日(指定几点几分几秒刷新)
  3. 每周(指定周几几点几分几秒刷新)
  4. 指定开始和结束时间(一次性)

计数器配置完成后可作为任务的参数,决定任务是否启动

@yiliangxiajiao yiliangxiajiao added the enhancement New feature or request label Aug 31, 2024
@runhey
Copy link
Owner

runhey commented Sep 1, 2024

很好的建议,不过2不会考虑。
2的应用场景非常少,几乎不存在,

  • 概率游戏可以依靠次数来推断数量
  • 前置基础还没实现 管挖不管填系列第二期 #354 掉落系统
  • 超多的配置约束,已经有时间和次数来限制了,再多一个那画面不敢想
  • 怎么会只打50个小绘卷,这千分都不到每天
  • 最重要的用的很少

@runhey
Copy link
Owner

runhey commented Sep 1, 2024

我读了很多遍,感觉是泛谈。
你的目标是解决异常导致计数重置问题,不应该引入新的东东。
当下计数最大一般伴随一个限时最大,这个两个已经够用了,而且现有的对用户暴露的选项已经够多了。
在Alas体系下一个任务是否执行只有一个指标next_run,否则就是在堆屎。

@runhey
Copy link
Owner

runhey commented Sep 1, 2024

我之前想的是,需要计数的任务多一个字段写到配置文件去(pydantic可以做到隐藏),现在引入一个全局的也是不错

@yiliangxiajiao
Copy link
Contributor Author

你说的有道理,我想一下怎么实现比较优雅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants