<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 6 Feb 2023 at 14:08, Paul Harrison <<a href="mailto:mythtv@mythqml.net">mythtv@mythqml.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 06/02/2023 11:17, Jan Ceuleers wrote:<br>
<br>
> On 05/02/2023 23:13, Klaas de Waal wrote:<br>
>>      I think ideally you have to have WakeUpThreshold >= global pre-roll +<br>
>>      120. So with your 250 seconds pre-roll I would try something like<br>
>>      370 or<br>
>>      400 for WakeUpThreshold. That should give you about 120 seconds between<br>
>>      events if I understand the problem properly.<br>
>><br>
>> Yes, I share your understanding of the logic but the HandleWakeSlave is<br>
>> not called early enough.<br>
>> My logs show most of the time only two REC_PENDING events, one on 60<br>
>> seconds and one on 30 seconds.<br>
>> I think I found where this comes from but I as this is the scheduler I<br>
>> need to be very careful....<br>
> I have changed the WakeUpThreshold to 600 (just to be on the safe side),<br>
> and I still only get two REC_PENDING events (at 60 and 29 seconds), same<br>
> as Klaas reports.<br>
><br>
> Cheers, Jan<br>
<br>
<br>
OK thanks for testing.<br>
<br>
<br>
The problem must be further up the code in the main scheduler loop which <br>
is not calling HandleWakeSlave early or often enough for the code that <br>
sends the REC_PENDING events to work properly. When it's working <br>
properly it should be sending events at approximately 120, 90, 60 and 30 <br>
seconds before recording starts.<br>
<br></blockquote><div>There is the constant kSleepCheck = 300 and this is the maximum number of</div><div>seconds to wait between scheduler runs.</div><div>See commit <span style="color:rgb(36,41,47);font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;text-align:right;white-space:nowrap">81dffd5ab6becb75f9e004ffe771519d23a58d87</span></div><div><span class="gmail-commit-author gmail-user-mention" title="Lawrence Rust" style="box-sizing:border-box;color:rgb(36,41,47);white-space:nowrap;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">Lawrence Rust</span><span style="color:rgb(36,41,47);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;white-space:nowrap"> authored and </span><span class="gmail-commit-author gmail-user-mention" title="Paul Harrison" style="box-sizing:border-box;color:rgb(36,41,47);white-space:nowrap;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">Paul Harrison</span><span style="color:rgb(36,41,47);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;white-space:nowrap"> committed </span><span datetime="2014-07-15T10:32:13Z" class="gmail-no-wrap" title="Jul 15, 2014, 12:32 PM GMT+2" style="box-sizing:border-box;white-space:nowrap;color:rgb(36,41,47);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">on Jul 15, 2014</span><span style="color:rgb(36,41,47);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;white-space:nowrap"> </span><span style="color:rgb(36,41,47);font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;text-align:right;white-space:nowrap"><br></span></div><div><span style="color:rgb(36,41,47);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;white-space:nowrap">where this was changed from a hardcoded 300 to the constant.</span></div><div>When kSleepCheck is changed to 30 seconds then there is always one REC_PENDING<br></div><div>in the first time window, from  120 to 90 seconds.</div><div>Paul, do you think that it is a problem for the scheduler to wake up every 30 seconds?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Klaas I wonder if we should be setting the  default for WakeUpThresold <br>
to pre-roll + 120 instead of 5 minutes if that setting is not present in <br>
the DB?<br></blockquote><div> </div><div>I think that this is a good idea because if we do not do this then there is a constraint</div><div>on the RecordPreRoll value that is both unwanted and difficult to explain to the casual user.</div><div>And there is no GUI option to change the WakeUpThreshold as far as I know.</div><div>In the slightly longer run we may consider separating WakeUpThreshold and REC_PENDING events;</div><div>the WakeUpThreshold is about starting slave backends and that is not necessarily related to REC_PENDING events.</div><div><br></div><div>Klaas.</div><div><br></div></div></div>