From: Lucian Mogosanu Date: Fri, 20 Sep 2019 16:49:59 +0000 (+0300) Subject: posts: a02 X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=98135d13d180eea0eebdcd828d10d559c5031cbf;p=thetarpit.git posts: a02 --- diff --git a/posts/y06/0a2-botworks-viii.markdown b/posts/y06/0a2-botworks-viii.markdown new file mode 100644 index 0000000..84ee9ba --- /dev/null +++ b/posts/y06/0a2-botworks-viii.markdown @@ -0,0 +1,102 @@ +--- +postid: 0a2 +title: Botworks: Trilemabot and Feedbot V patches, the autumn 2019 session +date: September 20, 2019 +author: Lucian Mogoșanu +tags: tmsr, tech +--- + +Since we're here, let's do a recap of the botworks series so far: + +* Trilemabot: [self-voicing][trilemabot-i] and [command + handling][trilemabot-ii]; +* [Keccak/manifest regrind][botworks-regrind] of the botworks tree; +* Feedbot: [checker][feedbot-i], [announcer][feedbot-ii], [irc + bot][feedbot-iii]. + +This is a lot of code, by the way. If there's any brave soul who's +willing to a. integrate cl-irc plus *all* its dependencies (same as +I've done with [Hunchentoot][hunchentoot-genesis]), then b. surgically +remove any and every thing that's not needed for c. IRC bots in +general, as well as d. [#trilema][trilema-bot-spec] bots and +e. Feedbot in particular, keeping *only* what's actually used -- then +you're more welcome to give it a shot. Anyways, if you're interested, +drop by #spyked on Freenode. + +As for today's subject, I've been brewing a couple of V patches in my +lab over the last month or so. Here they are: + +* [trilemabot-voicer-tweaks.vpatch][trilemabot-voicer-tweaks.vpatch] + ([seal][trilemabot-voice-tweaks.vpatch.spyked.sig]) +* [feedbot-concurrency-fixes.vpatch][feedbot-concurrency-fixes.vpatch] + ([seal][feedbot-concurrency-fixes.vpatch.spyked.sig]) + +This comes after about [nine months][feedbot-iii] of not touching the +code at all; and I sure as hell hope I don't have to add anything new +in the next eighteen. + +Trilemabot voicer tweaks: a. adds a new method to load the list of +voice OTPs (previously emitted by deedbot and saved via the converse +method) from a file[^1]; and b. makes the "filespec" argument for both +methods optional, adding a default value there. The reasoning behind b +is that I've been using this self-voicing method for months now, and +having to type the filename each and every time is annoying. I'm not +going to keep multiple files for this purpose, so the parameters +remain to be used only in special cases, e.g. backup or something. + +Feedbot concurrency fixes: a. fixes those [annoying +crashes][logz-1930054] that have been occuring until a month ago; +b. improves general performance (delivery, response time etc.) by +removing HTTP requests from critical sections; and c. removes some +useless functions that in hindsight have proven to be at best useless, +and at worst annoying. + +The fix for a is already outlined in [the logs][logz-1930069]: don't +have message delivery take over the main loop, do it only in +pre-defined bursts (see \*max-announce-burst\*[^2]). This should only +be necessary for the rpl\_ison handler, but I want the bot to act +consistenly, so both PM and in-channel delivery act the same. + +I implemented b by adding a new parameter to the update-feed! +function, denoting the feed as grabbed by [feedparse][feedparse], and +changing update-feed-db so that it calls try-parse-feed outside the +critical section, then passing the result to update-feed!. + +As for c, I had initially wanted the bot to do some extra management +when loading/saving state on the disk, e.g. not overwriting the +existing feed list in memory unless necessary, but this is clearly +overengineering and really, the basic stuff works just fine. So we can +do with just the two basic feedbot-{save,reload}-state methods +outlined in the [initial patch][feedbot-iii]. + +That's about it for now. If you want to use this and need any support +from yours truly, I'm in #spyked. + +[^1]: I honestly don't remember why I haven't included this in the + initial patch. Why the fuck be able to save voice OTPs and not + load them? + + I'm a weird one, but they say that acknowledging one's problems is + the first step towards fixing them, so... that's that. + +[^2]: Currently set to a conservative value of 5, for no particular + reason. This can be computed though: if the announcement delay is + one second and pings are checked every 30 seconds, then a value of + 29 (or even 30) should *in principle* work. + +[trilemabot-i]: /posts/y04/072-trilemabot-i.html +[trilemabot-ii]: /posts/y05/078-trilemabot-ii.html +[botworks-regrind]: /posts/y05/080-botworks-regrind.html +[feedbot-manual]: /posts/y05/081-feedbot-manual.html +[feedbot-i]: /posts/y05/08a-feedbot-i.html +[feedbot-ii]: /posts/y05/08b-feedbot-ii.html +[feedbot-iii]: /posts/y05/08c-feedbot-iii.html +[hunchentoot-genesis]: /posts/y06/09f-hunchentoot-genesis.html +[trilema-bot-spec]: http://trilema.com/2016/trilema-bot-spec/ +[trilemabot-voicer-tweaks.vpatch]: http://lucian.mogosanu.ro/src/botworks/v/patches/trilemabot-voicer-tweaks.vpatch +[trilemabot-voice-tweaks.vpatch.spyked.sig]: http://lucian.mogosanu.ro/src/botworks/v/seals/trilemabot-voicer-tweaks.vpatch.spyked.sig +[feedbot-concurrency-fixes.vpatch]: http://lucian.mogosanu.ro/src/botworks/v/patches/feedbot-concurrency-fixes.vpatch +[feedbot-concurrency-fixes.vpatch.spyked.sig]: http://lucian.mogosanu.ro/src/botworks/v/seals/feedbot-concurrency-fixes.vpatch.spyked.sig +[logz-1930054]: http://logs.nosuchlabs.com/log/trilema/2019-08-22#1930054 +[logz-1930069]: http://logs.nosuchlabs.com/log/trilema/2019-08-22#1930069 +[feedparse]: /posts/y05/087-feedparse.html