WebCore piston firing at 17 minutes past the hour rather than on the hour


#1

I might just recreate the piston to be honest but very strange behaviour.

Piston attached should run twice an hour, once on the hour and once 30 minutes past the hour.

But for some reason at randomly intervals it’s running at 17 minutes past the hour! Any ideas why this would happen?

07/03/2021, 12:17:59 +723ms
+2ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 2ms
+109ms ║Runtime (42266 bytes) successfully initialized in 8ms (v0.3.110.20191009) (105ms)
+110ms ║╔Execution stage started
+160ms ║║<br />
+161ms ║║<b>Warning</b>: file_get_contents(https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs/E-1R-AGILE-18-02-21-D/standard-unit-rates/?period_from=2021-03-07T12:30&period_to=2021-03-07T12:30): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
+161ms ║║in <b>/var/www/html/deecies/js/agilenow.php</b> on line <b>35</b><br />
+161ms ║║<br />
+161ms ║║<b>Warning</b>: array_column() expects parameter 1 to be array, null given in <b>/var/www/html/deecies/js/agilenow.php</b> on line <b>37</b><br />
+162ms ║║Executed virtual command log (3ms)
+168ms ║║Executed virtual command setVariable (3ms)
+172ms ║║Executed virtual command setVariable (1ms)
+217ms ║║Executed [Octopus Agile Price].setLevel (35ms)
+262ms ║╚Execution stage complete. (152ms)
+270ms ║Setting up scheduled job for Sun, Mar 7 2021 @ 12:30:00 PM GMT (in 720s), with 1 more job pending
+307ms ╚Event processed successfully (307ms)
07/03/2021, 12:17:56 +634ms
+1ms ╔Received event [Home].time = 1615119476029 with a delay of 603ms
+1223ms ║Runtime (42261 bytes) successfully initialized in 27ms (v0.3.110.20191009) (1218ms)
+1224ms ║╔Execution stage started
+1318ms ║║Executed virtual command httpRequest (28ms)
+1320ms ║║Requesting a wake up for Sun, Mar 7 2021 @ 12:18:21 PM GMT (in 24.0s)
+1386ms ║╚Execution stage complete. (163ms)
+1400ms ║Setting up scheduled job for Sun, Mar 7 2021 @ 12:18:21 PM GMT (in 23s), with 2 more jobs pending
+1407ms ╚Event processed successfully (1408ms)
07/03/2021, 12:17:49 +842ms
+1ms ╔Received event [Home].execute = recovery with a delay of 1272ms
+1076ms ║Runtime (42260 bytes) successfully initialized in 22ms (v0.3.110.20191009) (1072ms)
+1077ms ║╔Execution stage started
+1185ms ║║Executed virtual command wait (0ms)
+1186ms ║║Requesting a wake up for Sun, Mar 7 2021 @ 12:17:56 PM GMT (in 5.0s)
+1195ms ║╚Execution stage complete. (119ms)
+1204ms ║Setting up scheduled job for Sun, Mar 7 2021 @ 12:17:56 PM GMT (in 4s), with 2 more jobs pending
+1225ms ╚Event processed successfully (1226ms)

#2

Check your computer’s time if set correctly.


#3

It’s not that, it’s running on the same box all my timed pistons have been running on for the last 2 years. Not sure what happened, I recreated it and it’s firing fine now.


#4

Pistons schedule their own next execution time every time they run. If a scheduled event doesn’t occur, for whatever reason, the piston is dependent on another event happening (such as a device event) to put things back on track. As there is no way of knowing if that will happen, webCoRE tries to help out.

Every piston that you run will look to see if you have any other pistons waiting for a timer that is more than 30 seconds late. Subject to your webCoRE settings there is also a regular process doing the same thing. Any pistons found in that state are sent a ‘recovery’ event to try and help them out. That is what you are seeing. I can never remember what the two events look like, but you either have a piston that fires at 17 minutes past the hour, or the regular process is running at 17 minutes past.

As to why you weren’t getting the timer events … No idea.

This is one of the gotchas of webCoRE. My advice is always to hit pistons with unexpected events (the Test button usually suffices) to see if they are handled gracefully and don’t do anything stupid.


#5

Are you consistently seeing “Received event [Home].execute = recovery” in your logs? That can be a sign of congestion or other issues.

Give that webCoRE sometimes has issues with multiple web requests in a single piston (although I usually see this with POST not GET requests), I’d try splitting this into two separate pistons and see if the issue persists.


#6

You’re right - there is a recovery in there. What’s weird is it’s worked all night perfectly fine and it’s gone and done it again at 11:17am this morning which is the time it did it yesterday on the old piston.

Here’s my log back to 7am this morning.

08/03/2021, 11:17:59 +547ms
+1ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 1ms
+230ms ║<br />
+230ms ║<b>Warning</b>: file_get_contents(https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs/E-1R-AGILE-18-02-21-D/standard-unit-rates/?period_from=2021-03-08T11:30&period_to=2021-03-08T11:30): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
+230ms ║in <b>/var/www/html/deecies/js/agilenow.php</b> on line <b>35</b><br />
+230ms ║<br />
+230ms ║<b>Warning</b>: array_column() expects parameter 1 to be array, null given in <b>/var/www/html/deecies/js/agilenow.php</b> on line <b>37</b><br />
+367ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 11:30:00 AM GMT (in 720s), with 1 more job pending
+376ms ╚Event processed successfully (376ms)
08/03/2021, 11:17:57 +161ms
+2ms ╔Received event [Home].time = 1615202276159 with a delay of 1001ms
+1708ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 11:18:22 AM GMT (in 23s), with 2 more jobs pending
+1716ms ╚Event processed successfully (1715ms)
08/03/2021, 11:17:50 +30ms
+2ms ╔Received event [Home].execute = recovery with a delay of 1098ms
+1145ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 11:17:56 AM GMT (in 4s), with 2 more jobs pending
+1152ms ╚Event processed successfully (1152ms)
08/03/2021, 11:00:02 +139ms
+16ms ╔Received event [Home].time = 1615201200000 with a delay of 2137ms
+17898ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 11:00:00 AM GMT (in 1s), with 1 more job pending
+17919ms ╚Event processed successfully (17920ms)
08/03/2021, 10:30:50 +431ms
+1ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 2ms
+304ms ║15.246
+367ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 11:00:00 AM GMT (in 1749s), with 1 more job pending
+378ms ╚Event processed successfully (378ms)
08/03/2021, 10:30:48 +64ms
+1ms ╔Received event [Home].time = 1615199449920 with a delay of -1856ms
+527ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:31:12 AM GMT (in 23s), with 2 more jobs pending
+535ms ╚Event processed successfully (535ms)
08/03/2021, 10:30:43 +468ms
+3ms ╔Received event [Home].time = 1615199400000 with a delay of 43467ms
+1500ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:30:49 AM GMT (in 4s), with 2 more jobs pending
+1508ms ╚Event processed successfully (1508ms)
08/03/2021, 10:30:25 +177ms
+15ms ╔Received event [Home].time = 1615199400000 with a delay of 25173ms
+13217ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:30:00 AM GMT (in 1s), with 1 more job pending
+13228ms ╚Event processed successfully (13227ms)
08/03/2021, 10:30:04 +652ms
+20ms ╔Received event [Home].time = 1615199400000 with a delay of 4650ms
+12032ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:30:00 AM GMT (in 1s), with 1 more job pending
+12043ms ╚Event processed successfully (12042ms)
08/03/2021, 10:01:24 +401ms
+1ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 1ms
+884ms ║16.401
+1039ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:30:00 AM GMT (in 1714s), with 1 more job pending
+1048ms ╚Event processed successfully (1048ms)
08/03/2021, 10:01:20 +185ms
+2ms ╔Received event [Home].time = 1615197665890 with a delay of 14294ms
+2591ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:01:46 AM GMT (in 23s), with 2 more jobs pending
+2601ms ╚Event processed successfully (2601ms)
08/03/2021, 10:01:09 +851ms
+8ms ╔Received event [Home].time = 1615197665890 with a delay of 3960ms
+6992ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:01:05 AM GMT (in 1s), with 2 more jobs pending
+7013ms ╚Event processed successfully (7013ms)
08/03/2021, 10:00:59 +671ms
+2ms ╔Received event [Home].execute = recovery with a delay of 1225ms
+1236ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:01:05 AM GMT (in 4s), with 2 more jobs pending
+1245ms ╚Event processed successfully (1245ms)
08/03/2021, 10:00:50 +807ms
+20ms ╔Received event [Home].time = 1615197600000 with a delay of 50805ms
+7250ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:00:00 AM GMT (in 1s), with 1 more job pending
+7268ms ╚Event processed successfully (7268ms)
08/03/2021, 10:00:31 +210ms
+19ms ╔Received event [Home].time = 1615197600000 with a delay of 31209ms
+9606ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:00:00 AM GMT (in 1s), with 1 more job pending
+9615ms ╚Event processed successfully (9615ms)
08/03/2021, 10:00:01 +261ms
+23ms ╔Received event [Home].time = 1615197600000 with a delay of 1259ms
+17990ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:00:00 AM GMT (in 1s), with 1 more job pending
+18015ms ╚Event processed successfully (18015ms)
08/03/2021, 09:30:37 +522ms
+2ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 2ms
+1036ms ║17.1885
+1104ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 10:00:00 AM GMT (in 1761s), with 1 more job pending
+1114ms ╚Event processed successfully (1113ms)
08/03/2021, 09:30:32 +483ms
+4ms ╔Received event [Home].time = 1615195817710 with a delay of 14771ms
+3351ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:30:59 AM GMT (in 23s), with 2 more jobs pending
+3360ms ╚Event processed successfully (3359ms)
08/03/2021, 09:30:20 +883ms
+10ms ╔Received event [Home].time = 1615195817710 with a delay of 3171ms
+7585ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:30:17 AM GMT (in 1s), with 2 more jobs pending
+7608ms ╚Event processed successfully (7609ms)
08/03/2021, 09:30:12 +196ms
+0ms ╔Received event [Home].time = 1615195800000 with a delay of 12196ms
+630ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:30:17 AM GMT (in 4s), with 2 more jobs pending
+644ms ╚Event processed successfully (644ms)
08/03/2021, 09:30:01 +460ms
+16ms ╔Received event [Home].time = 1615195800000 with a delay of 1458ms
+8117ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:30:00 AM GMT (in 1s), with 1 more job pending
+8126ms ╚Event processed successfully (8126ms)
08/03/2021, 09:01:37 +745ms
+0ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 2ms
+880ms ║17.1885
+1036ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:30:00 AM GMT (in 1701s), with 1 more job pending
+1048ms ╚Event processed successfully (1049ms)
08/03/2021, 09:01:33 +819ms
+1ms ╔Received event [Home].time = 1615194076172 with a delay of 17645ms
+2301ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:02:00 AM GMT (in 23s), with 2 more jobs pending
+2310ms ╚Event processed successfully (2310ms)
08/03/2021, 09:01:21 +192ms
+4ms ╔Received event [Home].time = 1615194076172 with a delay of 5017ms
+8459ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:01:16 AM GMT (in 1s), with 2 more jobs pending
+8482ms ╚Event processed successfully (8482ms)
08/03/2021, 09:01:11 +510ms
+1ms ╔Received event [Home].time = 1615194000000 with a delay of 71510ms
+342ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:01:16 AM GMT (in 4s), with 2 more jobs pending
+352ms ╚Event processed successfully (351ms)
08/03/2021, 09:01:10 +147ms
+1ms ╔Received event [Home].execute = recovery with a delay of 1098ms
+1039ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:01:16 AM GMT (in 4s), with 2 more jobs pending
+1045ms ╚Event processed successfully (1045ms)
08/03/2021, 09:00:58 +261ms
+3ms ╔Received event [Home].time = 1615194000000 with a delay of 58259ms
+10387ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:00:00 AM GMT (in 1s), with 1 more job pending
+10401ms ╚Event processed successfully (10401ms)
08/03/2021, 09:00:34 +623ms
+28ms ╔Received event [Home].time = 1615194000000 with a delay of 34621ms
+15215ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:00:00 AM GMT (in 1s), with 1 more job pending
+15241ms ╚Event processed successfully (15241ms)
08/03/2021, 09:00:03 +362ms
+27ms ╔Received event [Home].time = 1615194000000 with a delay of 3360ms
+17306ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:00:00 AM GMT (in 1s), with 1 more job pending
+17320ms ╚Event processed successfully (17320ms)
08/03/2021, 08:31:05 +978ms
+1ms ╔Received event [Home].execute = recovery with a delay of 1178ms
+11348ms ║Piston waited at a semaphore for 10050ms
+11414ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:00:00 AM GMT (in 1722s), with 1 more job pending
+11426ms ╚Event processed successfully (11426ms)
08/03/2021, 08:31:11 +999ms
+1ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 1ms
+105ms ║16.7475
+123ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 9:00:00 AM GMT (in 1727s), with 1 more job pending
+133ms ╚Event processed successfully (132ms)
08/03/2021, 08:31:11 +68ms
+1ms ╔Received event [Home].time = 1615192272583 with a delay of -1515ms
+176ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:31:35 AM GMT (in 23s), with 2 more jobs pending
+182ms ╚Event processed successfully (182ms)
08/03/2021, 08:31:07 +89ms
+0ms ╔Received event [Home].time = 1615192200000 with a delay of 67088ms
+566ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:31:12 AM GMT (in 4s), with 2 more jobs pending
+573ms ╚Event processed successfully (573ms)
08/03/2021, 08:30:58 +748ms
+5ms ╔Received event [Home].time = 1615192200000 with a delay of 58746ms
+5712ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:30:00 AM GMT (in 1s), with 1 more job pending
+5728ms ╚Event processed successfully (5729ms)
08/03/2021, 08:30:45 +210ms
+3ms ╔Received event [Home].time = 1615192200000 with a delay of 45208ms
+6455ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:30:00 AM GMT (in 1s), with 1 more job pending
+6477ms ╚Event processed successfully (6476ms)
08/03/2021, 08:30:33 +826ms
+2ms ╔Received event [Home].time = 1615192200000 with a delay of 33824ms
+6333ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:30:00 AM GMT (in 1s), with 1 more job pending
+6355ms ╚Event processed successfully (6356ms)
08/03/2021, 08:30:09 +154ms
+26ms ╔Received event [Home].time = 1615192200000 with a delay of 9151ms
+15239ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:30:00 AM GMT (in 1s), with 1 more job pending
+15259ms ╚Event processed successfully (15258ms)
08/03/2021, 08:01:18 +418ms
+2ms ╔Received event [Home].time = 1615190441727 with a delay of 36689ms
+9371ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:30:00 AM GMT (in 1712s), with 1 more job pending
+9387ms ╚Event processed successfully (9388ms)
08/03/2021, 08:01:16 +249ms
+4ms ╔Received event [Home].time = 1615190441727 with a delay of 34520ms
+2307ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:30:00 AM GMT (in 1721s), with 1 more job pending
+2320ms ╚Event processed successfully (2321ms)
08/03/2021, 08:01:17 +66ms
+1ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 1ms
+262ms ║15.0885
+429ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:30:00 AM GMT (in 1722s), with 1 more job pending
+439ms ╚Event processed successfully (438ms)
08/03/2021, 08:01:14 +189ms
+1ms ╔Received event [Home].execute = recovery with a delay of 1120ms
+1203ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:01:39 AM GMT (in 23s), with 2 more jobs pending
+1211ms ╚Event processed successfully (1212ms)
08/03/2021, 08:00:56 +512ms
+22ms ╔Received event [Home].time = 1615190441727 with a delay of 14782ms
+15926ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:00:41 AM GMT (in 1s), with 2 more jobs pending
+15945ms ╚Event processed successfully (15945ms)
08/03/2021, 08:00:49 +635ms
+14ms ╔Received event [Home].time = 1615190400000 with a delay of 49633ms
+14906ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:00:41 AM GMT (in 1s), with 2 more jobs pending
+14917ms ╚Event processed successfully (14916ms)
08/03/2021, 08:00:35 +475ms
+2ms ╔Received event [Home].execute = recovery with a delay of 1616ms
+1280ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:00:41 AM GMT (in 4s), with 2 more jobs pending
+1287ms ╚Event processed successfully (1287ms)
08/03/2021, 08:00:14 +90ms
+24ms ╔Received event [Home].time = 1615190400000 with a delay of 14088ms
+19147ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:00:00 AM GMT (in 1s), with 1 more job pending
+19169ms ╚Event processed successfully (19168ms)
08/03/2021, 07:30:37 +839ms
+1ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 0ms
+117ms ║16.0755
+135ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 8:00:00 AM GMT (in 1762s), with 1 more job pending
+144ms ╚Event processed successfully (144ms)
08/03/2021, 07:30:35 +240ms
+2ms ╔Received event [Home].time = 1615188634660 with a delay of 579ms
+1961ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 7:31:01 AM GMT (in 23s), with 2 more jobs pending
+1968ms ╚Event processed successfully (1967ms)
08/03/2021, 07:30:24 +370ms
+4ms ╔Received event [Home].time = 1615188600000 with a delay of 24368ms
+5449ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 7:30:34 AM GMT (in 4s), with 2 more jobs pending
+5457ms ╚Event processed successfully (5458ms)
08/03/2021, 07:30:05 +862ms
+11ms ╔Received event [Home].time = 1615188600000 with a delay of 5860ms
+11422ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 7:30:00 AM GMT (in 1s), with 1 more job pending
+11431ms ╚Event processed successfully (11430ms)
08/03/2021, 07:01:34 +20ms
+1ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 0ms
+108ms ║14.511
+252ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 7:30:00 AM GMT (in 1705s), with 1 more job pending
+260ms ╚Event processed successfully (260ms)
08/03/2021, 07:01:31 +318ms
+4ms ╔Received event [Home].time = 1615186870801 with a delay of 20515ms
+2036ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 7:01:57 AM GMT (in 23s), with 2 more jobs pending
+2044ms ╚Event processed successfully (2043ms)
08/03/2021, 07:01:14 +139ms
+9ms ╔Received event [Home].time = 1615186870801 with a delay of 3336ms
+11204ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 7:01:10 AM GMT (in 1s), with 2 more jobs pending
+11226ms ╚Event processed successfully (11227ms)
08/03/2021, 07:01:04 +747ms
+1ms ╔Received event [Home].execute = recovery with a delay of 1154ms
+1068ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 7:01:10 AM GMT (in 4s), with 2 more jobs pending
+1078ms ╚Event processed successfully (1078ms)
08/03/2021, 07:00:46 +51ms
+16ms ╔Received event [Home].time/recovery = 1615186846028 with a delay of 19ms
+16988ms ║Setting up scheduled job for Mon, Mar 8 2021 @ 7:00:00 AM GMT (in 1s), with 1 more job pending
+17017ms ╚Event processed successfully (17017ms)


#7

Also when it fires at 11:17 the script it calls gets an error message.

Technically it shouldn’t touch the variable and yet it fills it with the error message.

I tried to put login in where by if the result isn’t a number between -20 and 35 then it should keep checking the script until it is. But for some reason that hasn’t worked - is there a better way of doing this? Ideally i’d like like the logic to say “if it’s not a number, keep looping until it is”


#8

Ok - so the piston is literally only firing at 17 minutes past the house at 11:17 and 12:17, no other times. It’s back on track now for 1pm at the next one.

This was the same yesterday, it fired at 11:17 and 12:17 and I had no other issues with it. I can’t see any other pistons that would be causing this behaviour - i’ve paused a few just in case but it continued to do it. I do have a number of pistons which fire based on the “value_inc_vat” amount changing this this piston would create but it doesn’t’ explain why this would only happen in two specific hours each day (I also don’t have any other pistons to run at these times in the morning either)

It also doesn’t explain why the bit of piston which looks for the result to be a number between -20 and 35 isn’t working - it should loop around rather than filling the variable with that error.


#9

All of your events other than the one at 11:17 AM are based on a timer having been set, indicated by the log as follows.

Received event [Home].time

The event at 11:17 is different:

Received event [Home].execute = recovery

I’m scratching my head over where that might be coming from. It doesn’t look like an external event.

Personally, I would be tempted to start fresh by rebuilding the piston, pausing or discarding the old one, and trying again. There may be some corruption in the original piston that we can’t see. That and rebuilding webCoRE’s data cache via the SmartApp are the only two thoughts I have at the moment based on what I see.


#10

I guess creating it as a duplicate wouldn’t help? (which is what I did here) and I should create the full thing from scratch?

Is there a cleaner or better way to check that the data it pulls from the link is just numbers and doesn’t try to put the error message (or any none values) into the variable?


#11

You could certainly try that first. I’m not sure either idea will help, I’m just going back to the old tried-and-true “reboot the computer” technique because for the moment I’m out of ideas. :man_shrugging:

Not clear on what you’re asking here, but I’m on the road and might have a better look when I’m back at my desk.


#12

It is one of the recovery events. One type appears as time/recovery = <timestamp> and one appears as execute = recovery in the logs. You can see one of each on 8th March at just after 7:00 am, and the execute one is happening every half an hour after that before suddenly appearing at 11:17 am.

It doesn’t look like events are being missed, so much as being delayed by absolutely ridiculous amounts e.g. the 8:30am event is 45 seconds late.


#13

Ah, missed the other recovery event. That’s what I get for trying to read the logs on my phone. :slightly_smiling_face:


#14

It’s weird isn’t it - that would also seem to make more sense if it was random. But so far in my tests, the 17 minute delay is always at 11:17 and 12:17. Coming up to that time today here in the UK so i’ll see what it does today.

If it does the same maybe I have to do something bizarre like pause the piston at that time and run another piston scheduled to go off at exactly 11am and 12am to do the same thing. It’s janky but it works I guess?


#15

Try to explain it a bit better. Basically the API that my external script calls occasionally fails and returns NULL or something blank instead of the number. Also in this case when the failure occurs because it accesses at the wrong time it returns that huge error message.

To prevent this going into the variable I tried to write a loop. I wanted the loop to just check if it was a number before writing, however I don’t believe that’s possible.The figure returned is only ever between -20 and 35 so I used that as a qualifier - that if the result isn’t between those two it should again until it gets a result that is.

For some reason when the 11:17 and 12:17 errors occur this doesn’t work as the error message gets logged in the variable which then turns everything on when it shouldn’t be as it ruins all the pistons that rely on this figure. I also wasn’t sure if the loop i’d written to do this was either the most efficient or reliable way to do check it. Perhaps also if I change the variable to a numerical rather than dynamic it would stop it entering at least numbers (and might just put a 0 if there is a failure, which is still bad if the price isn’t actually zero!)


#16

There is probably an explanation to be found for the 17 minutes past the hour thing - either the regular webCoRE recovery process or some other piston fired by a regular event is presumably firing, but the damage has been done earlier.

At 17 minutes past the hour the URL called has period_from and period_to set to the same time and that generates the error. How are they being calculated?

It is the havoc being created on the hour that is a mystery. Is there a particular reason for the five second wait? If a wait is needed could you drop it to four seconds just to get rid of a timer and clean things up a bit? Or even have two short ones adding up to five? I am just worried that the piston is getting confused as to what it is meant to be processing. There are some massive delays happening too.


#17

It is also possible resource limiters are terminating execution, and the recovery handler tries to get things going again.


#18

Rebuilding the cache appears to have fixed it - everything has been working perfectly for two days.

So now I just confirmation from someone that my check the returns from the external script are valid or not is the best way to do it?


#19

Glad to hear the cache suggestion worked.

In terms of checking the value of the response from the GET request, I tend to be in favor of using whatever approach works for you. We don’t have the same access or data to work with that you do, and that puts us at a disadvantage.

With that said, I admit that in lieu of the “While Loop” I might have used a “For Loop” with a counter and then a “break” when the desired response is received. This, IMO, has two advantage. (1) it eliminates the need for the duplicate code in line 50-54, and (2) ensures that the loop is stopped from running too long if the API ever becomes inaccessible for any reason. Roughly:

FOR 1 to 5 Step 1
(Your Get Request)
IF Value is Outside Range X to Y
Wait 30 Seconds
Else
-Break
ENDIF
END FOR

You could do something similar with a While or Repeat Loop using a counter variable that is incremented with each request, this is just my personal preference.