add expire_jobs and set default expire times

This commit is contained in:
Oliver Gorwits
2014-09-27 11:31:37 +01:00
parent f8e1507069
commit 4a6081fc58
4 changed files with 35 additions and 6 deletions

View File

@@ -40,6 +40,15 @@ sub expire {
});
}
if (setting('expire_jobs') and setting('expire_jobs') > 0) {
schema('netdisco')->txn_do(sub {
schema('netdisco')->resultset('Admin')->search({
entered => \[q/< (now() - ?::interval)/,
(setting('expire_jobs') * 86400)],
})->delete();
});
}
return job_done("Checked expiry for all Devices and Nodes");
}

View File

@@ -724,14 +724,14 @@ seconds as well as integers.
=head3 C<expire_devices>
Value: Number of Days.
Value: Number of Days. Default: 60
Devices that have not been refreshed in this number of days will be removed.
All nodes connected to this device will be removed as well.
=head3 C<expire_nodes>
Value: Number of Days.
Value: Number of Days. Default: 90
Nodes that have not been refreshed in this number of days will be removed from
the database. Archived and non-archived nodes are removed. This includes
@@ -739,11 +739,19 @@ SwitchPort/MAC and MAC/IP mappings.
=head3 C<expire_nodes_archive>
Value: Number of Days.
Value: Number of Days. Default: 60
Archived data for switch-port/MAC and MAC/IP mappings older than this number
of days will be removed.
=head3 C<expire_jobs>
Value: Number of Days. Default: 14
Jobs which entered the job queue more than this many days ago will be removed
from the queue during the scheduled expiry process (regardless of whether they
were ever run).
=head3 C<dns>
Value: Settings Tree. Default: