On 16/02/2021 11:59, Terry Coles wrote: > On Tuesday, 16 February 2021 10:50:59 GMT Terry Coles wrote: >> If anyone wants to look at the full package the code is on our GitLab >> Repository at: >> >> https://gitlab.com/wmtprojectsteam/minster_bells_re-engineering > BTW. I've now realised that I introduced (yet another) bug when I did the > last update. At the end of the file I wrote: > > if opening_hours: # Program has begun after 10 am, > sched.add_job(mp3_player_start, 'interval', seconds=10, > max_instances=1, id='First Start on Power Up') > > what I was trying to do was to get apscheduler to fire off the function > mp3_player_start ten seconds after the initial startup code had completed, > but > what I've actually done is triggered it every 10 secs with an instance max of > 1, which barfs. ;-( > > Is there a way to do this or should I simply forget about trying to do it > with > apscheduler?
Well I must say, I'm not that familiar with apscheduler, but it looks to me as if it's causing more issues and complexity than threading would, at least in some cases. I also don't think it exactly avoid threading, because apscheduler is probably using its own internal threading to achieve the results. If I wrote this, I'd be more likely to use multiple threads and some global state to control them - much like how I've done in the river system with variables like config.EXITING to signal program shutdown. Hamish
signature.asc
Description: OpenPGP digital signature
-- Next meeting: Online, Jitsi, Tuesday, 2021-03-02 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk