FCLT#89100 Verbetering putorders monitoring

svn path=/Website/branches/v2025.1/; revision=69083
This commit is contained in:
Jos Groot Lipman
2025-05-21 10:11:50 +00:00
parent 4b800c8d88
commit 5ed882e520
2 changed files with 29 additions and 2 deletions

View File

@@ -143,6 +143,31 @@ result.scanner.dbcreated = new Date(oRs("created").Value);
result.scanner.dbuser = oRs("user").Value;
oRs.Close();
// Busy taken
var sql = "SELECT fac_cust_customerid, "
+ " fac_task_code, "
+ " fac_task_nextrun, "
+ " fac_task_lastrun, "
+ " fac_task_flags"
+ " FROM fac_cust fc, fac_task ft "
+ " WHERE ft.fac_cust_key = fc.fac_cust_key "
+ " AND BITAND (fac_task_flags, 2) = 2 " // busy
+ " AND fac_task_nextrun IS NOT NULL"
+ " ORDER BY fac_cust_customerid, fac_task_code"
var oRs = Oracle.Execute(sql);
result.tasker = {};
while (!oRs.EOF)
{
var data = { "fac_task_code": oRs("fac_task_code").Value,
"fac_task_nextrun": new Date(oRs("fac_task_nextrun").Value),
"fac_task_lastrun": new Date(oRs("fac_task_lastrun").Value),
"fac_task_flags": oRs("fac_task_flags").Value
}
result.tasker[oRs("fac_cust_customerid").Value] = data;
oRs.MoveNext;
}
oRs.Close();
result.applicationpoolstart = new Date(Application("SET_INSTANCE_TIME"));

View File

@@ -73,7 +73,8 @@ function tasker_loop(params)
{
Log2File(1, "{0} Task seems busy in lockfile {1}\nNot starting task, trying again in 1 minute".format(toDateTimeString(new Date()), lockfilename));
var sqlu = "UPDATE fac_task"
+ " SET fac_task_nextrun = fac_task_nextrun + 1/60/24" // Over 1 minuut weer testen
+ " SET fac_task_nextrun = fac_task_nextrun + 1/60/24," // Over 1 minuut weer testen
+ " fac_task_flags = fac_task_flags + 2 - bitand(fac_task_flags, 2)" // zet bitje 2 om aan te geven dat we busy zijn
+ " WHERE fac_task_key = " + task_key;
Oracle.Execute(sqlu);
@@ -83,7 +84,8 @@ function tasker_loop(params)
var sqlu = "UPDATE fac_task"
+ " SET fac_task_nextrun = NULL,"
+ " fac_task_lastrun = SYSDATE"
+ " fac_task_lastrun = SYSDATE,"
+ " fac_task_flags = fac_task_flags - bitand(fac_task_flags, 2)" // reset busy bitje
+ " WHERE fac_task_key = " + task_key;
Oracle.Execute(sqlu);