后台有一个订单,这个订单有一个过期时间,我需要在过期时间 来更新一下订单状态
自己用 celery 的周期任务 每分钟轮询来实现 但这样轮询感觉不是很友好。
有没有这种能设置固定时间的任务?
自己用 celery 的周期任务 每分钟轮询来实现 但这样轮询感觉不是很友好。
有没有这种能设置固定时间的任务?

1 zdnuist Jul 30, 2018 Quartz |
2 b821025551b Jul 30, 2018 这种用 Redis 来实现很方便。 |
3 qf0129 Jul 30, 2018 via iPhone Celery 有 async_task 可以指定时间或者延迟执行 |
5 Rekkles Jul 30, 2018 crontab |
7 tomczhen   Jul 30, 2018 via Android 业余允许的话,在建立订单的时候设定好 expire at 时间,同时返回 expire in n sec 给前端,发生查询或业务时判断 expire at 时间来做是否过期判断。 |
9 misaka19000 Jul 30, 2018 为啥不友好?我觉得就挺好的 单独写个项目来处理这些定时任务不就行了 |
10 justseemore Jul 30, 2018 写 daemon 啊,时间肯定比一分钟短。。 |
11 victrec Jul 30, 2018 |
12 thinkwei2012 Jul 30, 2018 同意 Redis |
13 hahasong Jul 30, 2018 写个 go 服务长驻进程,周期性检查处理 |
14 Zzdex OP |
16 lshero Jul 30, 2018 延时队列 |
17 brickyang Jul 30, 2018 via iPhone |
18 lihongjie0209 Jul 30, 2018 DelayQueue 可以做, 但是一旦你考虑到任务持久化的问题, 轮询数据库最简单 |
19 sampeng Jul 30, 2018 了解一下 time wheel。。。。。其实就定时某一个时间点自然是每隔多久检查一下当前时间是什么时候。。 |
21 jimmyye Jul 30, 2018 http://docs.celeryproject.org/en/latest/userguide/calling.html#eta-and-countdown >The ETA (estimated time of arrival) lets you set a specific date and time that is the earliest time at which your task will be executed. countdown is a shortcut to set ETA by seconds into the future. |
22 wq7 Jul 30, 2018 1. celery 自带按照指定时间执行的任务功能,不过使用 redis 有坑(可以自己先踩踩)。 2. 用 go 实现一个定时。 3. 现成的定时框架。 |
23 Raymon111111 Jul 30, 2018 用缓存+时间片 然后轮询时间片 |
26 qf0129 Jul 31, 2018 eta 是个啥 这就不清楚了 |
27 fangdingjun Aug 1, 2018 我会用最懒的办法,数据库记录过期时间,显示订单时再更新状态 |