Merge branch 'master' of https://git.kappach.at/lda/Parsee into janet

This commit is contained in:
LDA 2024-11-17 16:25:30 +01:00
commit e3979e0e6e
5 changed files with 75 additions and 4 deletions

View file

@ -63,6 +63,34 @@ static const Argument arguments[] =
#undef Argument
};
void
ParseeCheckMatrix(void *datp)
{
static volatile uint64_t streak = 0;
ParseeData *data = datp;
if (!ASPing(data->config))
{
Log(LOG_ERR, "Cannot reach '%s' properly...", data->config->homeserver_host);
if (++streak >= 5)
{
Log(LOG_ERR, "This has been at least the fifth time in a row.");
Log(LOG_ERR, "Please check if your homeserver is active.");
Log(LOG_ERR, "%s shall now exit...", NAME);
pthread_mutex_lock(&data->halt_lock);
data->halted = true;
pthread_mutex_unlock(&data->halt_lock);
XMPPFinishCompStream(data->jabber);
pthread_join(xmpp_thr, NULL);
Log(LOG_INFO, "Stopping server...");
HttpServerStop(data->server);
}
return;
}
streak = 0;
}
int
Main(Array *args, HashMap *env)
{
@ -273,6 +301,7 @@ Main(Array *args, HashMap *env)
Log(LOG_NOTICE, "Starting up local cronjobs...");
cron = CronCreate(10 SECONDS);
CronEvery(cron, 5 MINUTES, ParseeCleanup, conf.handlerArgs);
CronEvery(cron, 10 SECONDS, ParseeCheckMatrix, conf.handlerArgs);
ParseeCleanup(conf.handlerArgs);
CronStart(cron);