GithubHelp home page GithubHelp logo

Comments (5)

ydf0509 avatar ydf0509 commented on September 25, 2024

问的很好,
所以funboost 提供了持久化的apschudler对象,
你可以看 funboost/timing_job/apscheduler_use_redis_store.py 的funboost_background_scheduler_redis_store对象, 你还可以使用任何 mysql mongo来作为持久化的定时存储,
funboost_background_scheduler_redis_store = FunboostBackgroundScheduler(timezone=FunboostCommonConfig.TIMEZONE, daemon=False, jobstores=jobstores)
由什么存储,其实是和 jobstores 有关,aspcheduler原生就支持 jobstores 入参了, 你可以看看4.4.b文档,里面用的就是funboost_background_scheduler_redis_store 对象

from funboost.

ydf0509 avatar ydf0509 commented on September 25, 2024

image
你可以按照redis作为定时任务持久化的例子,使用任何数据库作为定时任务持久化,还是比较简单的

from funboost.

Nongzhsh avatar Nongzhsh commented on September 25, 2024

APScheduler库本身是支持持久化的 但是在你框架中的funboost_aps_scheduler是基于内存的方式实现的定时任务,也就是说如果我执行一个较长时间后才执行的一个定时任务,万一中途出现程序中断服务器宕机这样的情况的话,该任务就会丢失,不知道我这样的理解是否正确。 我目前有两个场景需要用到定时任务,第一个是订单状态的转化,如果用户超过15min未支付,需要将该订单的状态设置为关闭。 第二个场景是这样的,用户在下订单后,需要与一种公共资源建立关联,这种关联是多对多的关系,因此我需要在这个公共资源上设置一个字段表示资源是否可用,我需要在一年后将这个资源进行释放,也就是修改这个字段。 按照我从funboost文档中的理解,使用funboost_aps_scheduler如果中途程序关闭就会丢失此任务,不知道我的理解是否正确,另外我不太清楚情景2采用一年后执行的定时任务这种方案,是否是一种比较好的方案,感谢作者提供这么优秀的框架,希望作者替我解惑

持久化是都是支持的,对于场景2,应该不是真的设定一个一年之后的定时任务吧,应该是定义一个每天(根据实际的及时性要求,设定心跳)的定时任务,检测资源是否已经满足一年期限。

from funboost.

ydf0509 avatar ydf0509 commented on September 25, 2024

都可以,持久化后定时任务就不会丢失了,jobstores也可以定义成mysql或者mongo来存储,这些用法其实是和aspcheduler关系大,和funboost关系不大

from funboost.

davincilll avatar davincilll commented on September 25, 2024

感谢解答🙏

from funboost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.