NODE JS CRON JOBS (ALL YOU NEED TO KNOW)

Поделиться
HTML-код
  • Опубликовано: 8 сен 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 😊

  • @prasanthmanimaran5158
    @prasanthmanimaran5158 2 года назад +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  2 года назад +3

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

    • @rahimshash1631
      @rahimshash1631 8 месяцев назад

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

  • @bhagavathchoudhary4519
    @bhagavathchoudhary4519 Год назад +1

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

  • @MrSeredan
    @MrSeredan Год назад +1

    Best tutorial ❤

  • @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 :)

  • @LightDarkBlue
    @LightDarkBlue 4 месяца назад

    Great video you walked through everything thank you :)

  • @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 :)

  • @sukanyaa1110
    @sukanyaa1110 2 года назад +1

    Thank you so much, sir. clearly explained

  • @ufyohwo3613
    @ufyohwo3613 6 месяцев назад

    awesome tutorial, thank you!

  • @musicworld9868
    @musicworld9868 2 года назад +1

    Awesome video sir, Learned a lot.

  • @abessesmahi4888
    @abessesmahi4888 Год назад +1

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

  • @NaveenKumar-ue6oc
    @NaveenKumar-ue6oc 2 года назад +1

    i'm from India Thanks...❤

  • @GabrielArghire
    @GabrielArghire 2 года назад +1

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

  • @rufansdev7446
    @rufansdev7446 2 года назад +1

    Thank you. wow

  • @prgrmr-yn
    @prgrmr-yn Год назад

    Awesome stuff man love it

  • @fadhilrahman8346
    @fadhilrahman8346 10 месяцев назад +1

    thnks bro

  • @alii4334
    @alii4334 Год назад +2

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

  • @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 2 года назад +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.

  • @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/

  • @sourabhvaishnav8235
    @sourabhvaishnav8235 Год назад

    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 :)