summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/PluginHost.php6
-rw-r--r--sql/pgsql/migrations/150.sql1
-rw-r--r--sql/pgsql/schema.sql1
3 files changed, 7 insertions, 1 deletions
diff --git a/classes/PluginHost.php b/classes/PluginHost.php
index 484364f26..e417fde1f 100644
--- a/classes/PluginHost.php
+++ b/classes/PluginHost.php
@@ -968,12 +968,15 @@ class PluginHost {
if ($task['cron']->isDue($last_run)) {
Debug::log("Task $task_name is due, executing...");
+ $task_started = time();
$rc = (int) $task['callback']();
+ $task_duration = time() - $task_started;
- Debug::log("Task $task_name has finished with RC=$rc, recording timestamp...");
+ Debug::log("Task $task_name has finished in $task_duration seconds with RC=$rc, recording timestamp...");
if ($task_record) {
$task_record->last_run = time();
+ $task_record->last_duration = $task_duration;
$task_record->last_rc = $rc;
$task_record->save();
@@ -982,6 +985,7 @@ class PluginHost {
$task_record->set([
'task_name' => $task_name,
+ 'last_duration' => $task_duration,
'last_rc' => $rc,
'last_run' => Db::NOW(),
]);
diff --git a/sql/pgsql/migrations/150.sql b/sql/pgsql/migrations/150.sql
index 55d9609e9..c0aae3bdf 100644
--- a/sql/pgsql/migrations/150.sql
+++ b/sql/pgsql/migrations/150.sql
@@ -1,5 +1,6 @@
create table ttrss_scheduled_tasks(
id serial not null primary key,
task_name varchar(250) unique not null,
+ last_duration integer not null,
last_rc integer not null,
last_run timestamp not null default NOW());
diff --git a/sql/pgsql/schema.sql b/sql/pgsql/schema.sql
index 3ff9a6674..7e995f915 100644
--- a/sql/pgsql/schema.sql
+++ b/sql/pgsql/schema.sql
@@ -398,6 +398,7 @@ create table ttrss_error_log(
create table ttrss_scheduled_tasks(
id serial not null primary key,
task_name varchar(250) unique not null,
+ last_duration integer not null,
last_rc integer not null,
last_run timestamp not null default NOW());