Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#3704 closed Task (fixed)

Task Scheduler Improvements

Reported by: JulienM Owned by: JulienM
Priority: normal Milestone: 1.x - Piwik 1.x
Component: Core Keywords:
Cc: Sensitive: no

Description (last modified by JulienM)

  1. Task parameters

It is currently not possible to schedule the execution of a method with parameters, see TaskScheduler.php#L98

This is required to be able to send PDF/HTML/SMS at different times, see #3706.

In a first iteration, only one parameter will be supported.

  1. Timetable cleanup

Tasks that are being scheduled are stored in the option table in the option name "TaskScheduler.timetable".

In future updates of Piwik, if a scheduled task is not needed anymore, it would not be removed from the option table.

  1. Do not execute a newly created task

Currently, if a task has never been executed, it will be executed as soon as the runTasks() method retrieves the new task via the Piwik_PostEvent() method.

See TaskScheduler.php#L80 :

/*
 * Task has to be executed if :
 *      - it is the first time, ie. rescheduledTime is not set
 *  - that task has already been executed and the current system time is greater than the
 *    rescheduled time.
 */

The task should only be scheduled and not run.

Note: do not break the $forceScheduledTasks feature.

Change History (13)

comment:1 Changed 15 months ago by JulienM (JulienMoumne)

  • Owner set to JulienM
  • Status changed from new to assigned

comment:2 Changed 15 months ago by JulienM (JulienMoumne)

  • Description modified (diff)

comment:3 Changed 15 months ago by JulienM (JulienMoumne)

  • Description modified (diff)

comment:4 Changed 15 months ago by JulienM (JulienMoumne)

  • Description modified (diff)

comment:5 Changed 15 months ago by JulienM (JulienMoumne)

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [7790]) fixes #3704 #3706

comment:6 Changed 15 months ago by JulienM (JulienMoumne)

(In [7791]) refs #3704 #3706 r7790 missing test updates

comment:7 Changed 15 months ago by JulienM (JulienMoumne)

(In [7792]) refs #3704 #3706 r7790 time() in unit tests needs to be made invariant for slow machines

comment:8 Changed 15 months ago by matt (mattab)

(In [7803]) I can replicate failure locally by executing: phpunit --filter TaskScheduler
Temporarily disabling the tests that stub the Option object, which I think may be causing the problem? refs #3704 #3706

comment:9 Changed 15 months ago by matt (mattab)

(In [7808]) small UX chagne + trigger update refs #3704 #3706

comment:10 Changed 15 months ago by matt (mattab)

(In [7810]) Re-enabling tests refs #3704 #3706

comment:11 Changed 15 months ago by JulienM (JulienMoumne)

(In [7813]) refs #3704 #3706 r7790

  • fix test for slow execution
  • re-enable tests

comment:12 Changed 15 months ago by JulienM (JulienMoumne)

(In [7814]) refs #3704 #3706 r7790 restore event dispatcher & piwik options

comment:13 Changed 15 months ago by JulienM (JulienMoumne)

(In [7820]) refs #3704 #3706 r7790 restore Piwik_PDFReports_API

Note: See TracTickets for help on using tickets.