be very careful with plugin schedule  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

be very careful with plugin schedule

Postby perry » Wed Oct 05, 2016 3:40 pm

I guess this should be reported as bug, however, it is related to plugin development as well...

Jiwa 7.0.157

I found few issues with setting up plugin schedule in the past almost all caused me heartache...
1. schedule type = "One Time", it runs everytime schedule service runs, i.e. never stops
- I heard this is fixed in a recent version (post .157) but I haven't tried yet.
2. if your code in Execute(...) throws an error, the particular schedule will rerun (due to next run time not set at the end I assume)
- sample below, if you dont catch your error, your step1() will get executed over and over...
Code: Select all
Public Class ScheduledExecutionPlugin
        Inherits System.MarshalByRefObject
        Implements JiwaApplication.IJiwaScheduledExecutionPlugin

        Public Sub Execute(ByVal Plugin As JiwaApplication.Plugin.Plugin, ByVal Schedule As JiwaApplication.Schedule.Schedule) Implements JiwaApplication.IJiwaScheduledExecutionPlugin.Execute
Try
   step1() 'no error
   step2() 'throws error
Catch ex As Exception
    'suppress exception
End Try
    End Class


3. monthly schedule is weird... I setup a monthly schedule (runs first sunday of every 1 month) on 2016-08-25.
- first schedule ran ok on 2016-09-04
- it didn't run 2016-10-02 (last Sunday)
- it ran yesterday... (2016-10-04)
- looks like it is just doing Month +1

4. dont export your plugin (from dev) with schedule...
- on import, it creates a new schedule and you end up with same schedule many times

One of my plugin is to email 1000+ invoices to customers and you dont want it repeated every 1 min :)

Apart from bug fixes, I also would like to know if this can be implemented
- setup multiple instances of plugin schedule service and each can run different plugin schedules
If we can at least specify a name on each service instance and have that passed into Execute() as a parameter
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: be very careful with plugin schedule  Topic is solved

Postby Mike.Sheen » Sat Nov 12, 2016 4:47 pm

perry wrote:1. schedule type = "One Time", it runs everytime schedule service runs, i.e. never stops
- I heard this is fixed in a recent version (post .157) but I haven't tried yet.


Yes, fixed in DEV-5275 for 7.00.167.00 and later

perry wrote:2. if your code in Execute(...) throws an error, the particular schedule will rerun (due to next run time not set at the end I assume)
- sample below, if you dont catch your error, your step1() will get executed over and over...


Yes, this is expected and your strategy for dealing with it is fine.

perry wrote:3. monthly schedule is weird... I setup a monthly schedule (runs first sunday of every 1 month) on 2016-08-25.
- first schedule ran ok on 2016-09-04
- it didn't run 2016-10-02 (last Sunday)
- it ran yesterday... (2016-10-04)
- looks like it is just doing Month +1


I have logged DEV-5659 to look into this.

perry wrote:4. dont export your plugin (from dev) with schedule...
- on import, it creates a new schedule and you end up with same schedule many times


I'm not able to reproduce this issue - can you provide detailed steps to reproduce?

perry wrote:Apart from bug fixes, I also would like to know if this can be implemented
- setup multiple instances of plugin schedule service and each can run different plugin schedules
If we can at least specify a name on each service instance and have that passed into Execute() as a parameter


We have an article in our document portal to show how to have the scheduler service running multiple times on the same machine. This doesn't quite help, as each instance will run all schedules - so I've added DEV-5660 to add the improvement to allow some sort of filter to specify which plugins or schedules each instance should run.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: be very careful with plugin schedule

Postby perry » Fri Nov 18, 2016 11:29 am

Hi Mike,
perry wrote:
4. dont export your plugin (from dev) with schedule...
- on import, it creates a new schedule and you end up with same schedule many times


I'm not able to reproduce this issue - can you provide detailed steps to reproduce?

Sample plugin attached, tested with Jiwa 7.157.0 (2 instances) and steps below
On database A
- created test plugin with a schedule and export
On database B
- import plugin
- save plugin
- import the same plugin again
Attachments
Plugin _testSchedule.xml
(29.28 KiB) Downloaded 124 times
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: be very careful with plugin schedule

Postby Mike.Sheen » Fri Nov 18, 2016 12:36 pm

Thanks - I'm able to reproduce the issue - logged as DEV-5666.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests