How to disable jsreport correctly?



  • Hi,

    i am using jsreport-core in node.js to develop an application that uses the jsreport-scheduling extension to create schedules that saves/emails the created the reported.
    I want to give the user the option to be able to enable/disable the schedule.
    I am disabling/enabling the schedule by updating the existing schedule in the following manner :-

    jsreport.documentStore.collection("schedules").update(
              { _id: schedule._id },
              {
                $set: {
                  enabled: args.enabled
                }
              });
    

    Now after disabling the schedule by setting enabled: false, whenever i enable it again by enabled: true, the scheduler generates and emails the report multiple times.

    For example - If my scheduler runs every 5 mins and i disable it for 20 mins. Then when i enable it again, it runs 4 times.

    How can i prevent this from happening? I want the scheduler to run only once after i enable it.



  • Hi,
    thanks for reporting this.
    It seems we missed this in the implementation. We will fix it here
    https://github.com/jsreport/jsreport-scheduling/issues/9


  • administrators

    hi @pakhi-newgen can you install the extension using npm i jsreport/jsreport-scheduling and try again? we have done some changes that should prevent this to happen



  • Hey,
    I tried it again by installing using jsreport/jsreport-scheduling, but its still runs pending number of times when i enable it again.


  • administrators

    @pakhi-newgen hmm i tried to reproduce what you describe but i could not find a good way to do it, so if you can provide a github repository with some simplified code that you are using to reproduce this, i can take a look. probably try to change the scheduler to just 1 minute so i can reproduce the example without having to wait too long


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.