Giter Site home page Giter Site logo

Comments (3)

elbert-chan avatar elbert-chan commented on August 18, 2024

I am thinking that in the actual project application scenario, our cron actually runs under multiple nodes.

I was wondering if I could provide an independent way to support the multi-node guarantee of single-node operation.

Through a distributed lock to ensure that only one of the multiple nodes can perform tasks?
If you use this scheme, you need to ensure that the time of multiple nodes is consistent.

Do you have a better plan? Look forward to further communication with you

from cron.

flc1125 avatar flc1125 commented on August 18, 2024

I am thinking that in the actual project application scenario, our cron actually runs under multiple nodes.我在想,在实际的项目应用场景中,我们的cron实际上是在多个节点下运行的。
I was wondering if I could provide an independent way to support the multi-node guarantee of single-node operation.我想知道我是否可以提供一种独立的方式来支持单节点操作的多节点保证。

Through a distributed lock to ensure that only one of the multiple nodes can perform tasks?通过分布式锁来保证多个节点中只有一个可以执行任务? If you use this scheme, you need to ensure that the time of multiple nodes is consistent.如果使用此方案,则需要保证多个节点的时间一致。

Do you have a better plan? Look forward to further communication with you你有更好的计划吗?期待与您的进一步沟通

I wrote a Mutex to implement a distributed single server to run. This is my implementation on go-kratos.

https://github.com/go-kratos-ecosystem/components/tree/2.x/crontab

PS: I don't think it's optimal, there's room for improvement, but I haven't had time to think about it. If you have any better suggestions, I'd love to hear them.

from cron.

flc1125 avatar flc1125 commented on August 18, 2024

I am thinking that in the actual project application scenario, our cron actually runs under multiple nodes.
I was wondering if I could provide an independent way to support the multi-node guarantee of single-node operation.

Through a distributed lock to ensure that only one of the multiple nodes can perform tasks? If you use this scheme, you need to ensure that the time of multiple nodes is consistent.

Do you have a better plan? Look forward to further communication with you你有更好的计划吗?期待与您进一步沟通

I implemented a package to solve this problem, the address of the package is: https://github.com/go-kratos-ecosystem/components/tree/2.x/crontab/jobwrapper/mutex

How to use it: https://github.com/go-kratos-ecosystem/components/blob/2.x/crontab/README.md

from cron.

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.