NODE JS CRON JOBS (ALL YOU NEED TO KNOW)

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 35

  • @prgrmr-yn
    @prgrmr-yn ปีที่แล้ว +5

    I love watching small topic long videos coz i work in nontech fulltime so cant practice too much, doing this way feels like i am typing myself, i would go home and i start typing,everything just comes naturally 😊

  • @bhagavathchoudhary4519
    @bhagavathchoudhary4519 2 ปีที่แล้ว +1

    Your explanation is awesome! you have Amazing Talent!!!

  • @prasanthmanimaran5158
    @prasanthmanimaran5158 3 ปีที่แล้ว +9

    Thanks a million, sir. Finally, I was able to set up a cron job for my database rows deletion on remote server :)

    • @degraphe8824
      @degraphe8824  3 ปีที่แล้ว +3

      I’m happy to have helped you :)
      I have more coming soon.
      Thanks for your support

    • @rahimshash1631
      @rahimshash1631 11 หลายเดือนก่อน

      can I have a link to your git repository, working on something similar

  • @Finn-jp6pn
    @Finn-jp6pn 2 ปีที่แล้ว +3

    Learned a lot. Thanks! I really hope you keep producing more content

    • @degraphe8824
      @degraphe8824  2 ปีที่แล้ว

      Amazing. Thank you for you kind comments. I will indeed keep producing more content. Thank you for liking my content. Please share to others that may gain from this information as well :)

  • @MrSeredan
    @MrSeredan ปีที่แล้ว +1

    Best tutorial ❤

  • @LightDarkBlue
    @LightDarkBlue 7 หลายเดือนก่อน

    Great video you walked through everything thank you :)

    • @degraphe8824
      @degraphe8824  6 หลายเดือนก่อน

      Glad it was helpful!

  • @enduranceochonogor6291
    @enduranceochonogor6291 2 ปีที่แล้ว +2

    Liked and subscribed. Awesome stuff here man.
    Believe me you're one of those with the talent to teach. I'm gonna refer all my programming friends here anyday.
    Just keep putting out awesome content like this one.

    • @degraphe8824
      @degraphe8824  2 ปีที่แล้ว

      OMG thanks so much for this.
      I really appreciate your kind words!!
      I'll keep on trying to put out similar content.
      Loads more where this came from :)

  • @musicworld9868
    @musicworld9868 2 ปีที่แล้ว +1

    Awesome video sir, Learned a lot.

  • @prgrmr-yn
    @prgrmr-yn ปีที่แล้ว

    Awesome stuff man love it

  • @abessesmahi4888
    @abessesmahi4888 2 ปีที่แล้ว +1

    It will nice if you increase the font size of editor.
    Thank you so much for your efforts.

  • @ufyohwo3613
    @ufyohwo3613 9 หลายเดือนก่อน

    awesome tutorial, thank you!

  • @sukanyaa1110
    @sukanyaa1110 2 ปีที่แล้ว +1

    Thank you so much, sir. clearly explained

  • @GabrielArghire
    @GabrielArghire 2 ปีที่แล้ว +1

    A suggestion for next videos: increase the font size for easier readability.

  • @alii4334
    @alii4334 2 ปีที่แล้ว +2

    how to stop task conditionally without running an additional task for checking?

  • @NaveenKumar-ue6oc
    @NaveenKumar-ue6oc 2 ปีที่แล้ว +1

    i'm from India Thanks...❤

  • @riturajjha
    @riturajjha 2 ปีที่แล้ว +1

    I have a time column in database... I want to run cronjob at that time once a user adds a new time in db... How to do that??

  • @ranjithanarayan8852
    @ranjithanarayan8852 3 ปีที่แล้ว +1

    Please add vedio of CRON job with stopping the tasks once it reached end date

    • @degraphe8824
      @degraphe8824  2 ปีที่แล้ว

      Alright I will create something like that in the very near future, but to give you a spoiler, it involves using the .stop() method on the task that has been created, once the cron job runs the first time.
      there are several ways to achieve this.

  • @rufansdev7446
    @rufansdev7446 2 ปีที่แล้ว +1

    Thank you. wow

  • @sourabhvaishnav8235
    @sourabhvaishnav8235 2 ปีที่แล้ว

    I am having dupication from node-cron. What to do?

  • @dk11soccer
    @dk11soccer 2 ปีที่แล้ว

    Can you talk about Unit Testing a cron job or is this all Integration testing?

  • @dikimuhamadsyidik9650
    @dikimuhamadsyidik9650 2 ปีที่แล้ว +1

    [ASK] how to handle the scheduled cron if the server goes down but we want to keep the job is still define ? thanks you

    • @degraphe8824
      @degraphe8824  2 ปีที่แล้ว +4

      That is a very good question.
      one way of doing that is to save a reference to the job in a database.
      So that if the server is down, whenever the server comes back up, it searches for that reference of any uncompleted jobs in the database and then executes the cron job or cron jobs again.
      feel free to ask me anything else you don't understand.

    • @dikimuhamadsyidik9650
      @dikimuhamadsyidik9650 2 ปีที่แล้ว +1

      @@degraphe8824 so we save the cron job schedule to the database and use the cron from job is that true ? or we use the database for log ?

    • @enduranceochonogor6291
      @enduranceochonogor6291 2 ปีที่แล้ว +1

      Thanks man for the awesome tutorial.
      Please can you make a video about the database jobs you just talked about, like what is the reasoning behind it.
      Does it have anything to do with queuing ???

    • @degraphe8824
      @degraphe8824  2 ปีที่แล้ว +1

      @@dikimuhamadsyidik9650
      There are a lot of ways to solve the problem of when the server goes down
      So basically in my mind how it works is.
      You save the reference to the cron jobs in the database, like say - a mongoose model called Cronjobs. Where the cronstring will be stored along with the name of function to be executed, and maybe the status of the cron (active: true or active:false).
      So that when the server is back up,
      It queries the data base for the documents of cron job collection and execute any active crons.
      There are other ways to handle things like this.
      You could also set a cron job as a Google cloud function or lambda. That will be set up the Google cloud server for execution only when the time for the cron job is reached.
      I'll release a video on the latter solution soon.
      I hope I've been able to clarify somethings
      Apologies for the delay🙂

    • @degraphe8824
      @degraphe8824  2 ปีที่แล้ว

      @@enduranceochonogor6291
      Yes I will make a video to clarify.
      There are several ways to handle the jobs problem for when the server is down
      I will make a video soon about this.
      Watch this space :)

  • @fadhilrahman8346
    @fadhilrahman8346 ปีที่แล้ว +1

    thnks bro

  • @qcmira2024
    @qcmira2024 2 ปีที่แล้ว +1

    Great video ! I learned a lot of helpful stuff for my own projects. How are Cron jobs different from BullMQ jobs?

    • @degraphe8824
      @degraphe8824  2 ปีที่แล้ว

      I am very happy that this was helpful to you. nothing warms my heart more than seeing comments as these. Thanks a lot.
      To answer your question BullMQ jobs and NodeJS cron jobs, although appearing similar on the surface are quite different in functionality.
      For instance BullMQ jobs are built to work primarily with a redis database under the hood and cronjobs have nothing to do with redis.
      BullMQ jobs of course uses a queueing system, where jobs are placed on wait to be executed, but cronjobs pretty much can be set to run at multiple specific times down to the timezone of the required job.
      They both have their advantages and use cases of course. like BullMQ is primarily used with typescript as well as with a system built with microservice architecture.
      The BullMQ docs is pretty cool and exhaustive, I'd advice you to go through it and give it a whirl. Of course I will be working on a BullMQ video in the future.
      docs.bullmq.io/