* When displaying ref count deltas to the log, show +1 instead of just 1 for increments.
* Added a new command TDAP which can be used by an Aide to manually initiate a run of The Dreaded Auto-Purger.
int users_not_purged;
char *users_corrupt_msg = NULL;
char *users_zero_msg = NULL;
int users_not_purged;
char *users_corrupt_msg = NULL;
char *users_zero_msg = NULL;
struct ctdlroomref *rr = NULL;
struct ctdlroomref *rr = NULL;
extern struct CitContext *ContextList;
extern struct CitContext *ContextList;
+int force_purge_now = 0; /* set to nonzero to force a run right now */
/* If the room is set to expire by count, do that */
if (epbuf.expire_mode == EXPIRE_NUMMSGS) {
if (num_msgs > epbuf.expire_value) {
/* If the room is set to expire by count, do that */
if (epbuf.expire_mode == EXPIRE_NUMMSGS) {
if (num_msgs > epbuf.expire_value) {
*/
now = time(NULL);
localtime_r(&now, &tm);
*/
now = time(NULL);
localtime_r(&now, &tm);
- if ((tm.tm_hour != config.c_purge_hour) || ((now - last_purge) < 43200)) {
+ if (
+ ((tm.tm_hour != config.c_purge_hour) || ((now - last_purge) < 43200))
+ && (force_purge_now == 0)
+ ) {
CtdlThreadSleep(60);
continue;
}
CtdlThreadSleep(60);
continue;
}
{
CtdlLogPrintf(CTDL_INFO, "Auto-purger: finished.\n");
last_purge = now; /* So we don't do it again soon */
{
CtdlLogPrintf(CTDL_INFO, "Auto-purger: finished.\n");
last_purge = now; /* So we don't do it again soon */
}
else
CtdlLogPrintf(CTDL_INFO, "Auto-purger: STOPPED.\n");
}
else
CtdlLogPrintf(CTDL_INFO, "Auto-purger: STOPPED.\n");
+/*
+ * Manually initiate a run of The Dreaded Auto-Purger (tm)
+ */
+void cmd_tdap(char *argbuf) {
+ if (CtdlAccessCheck(ac_aide)) return;
+ force_purge_now = 1;
+ cprintf("%d Manually initiating a purger run now.\n", CIT_OK);
+}
/*****************************************************************************/
/*****************************************************************************/
if (!threading)
{
CtdlRegisterProtoHook(cmd_fsck, "FSCK", "Check message ref counts");
if (!threading)
{
CtdlRegisterProtoHook(cmd_fsck, "FSCK", "Check message ref counts");
+ CtdlRegisterProtoHook(cmd_tdap, "TDAP", "Manually initiate auto-purger");
}
else
CtdlThreadCreate("Auto Purger", CTDLTHREAD_BIGSTACK, purge_databases, NULL);
}
else
CtdlThreadCreate("Auto Purger", CTDLTHREAD_BIGSTACK, purge_databases, NULL);
struct arcq arcq_rec;
int num_records_processed = 0;
struct arcq arcq_rec;
int num_records_processed = 0;
- snprintf(file_arcq_temp, sizeof file_arcq_temp, "%s2", file_arcq);
+ snprintf(file_arcq_temp, sizeof file_arcq_temp, "%s.%04x", file_arcq, rand());
begin_critical_section(S_SUPPMSGMAIN);
if (arcfp != NULL) {
begin_critical_section(S_SUPPMSGMAIN);
if (arcfp != NULL) {
smi.meta_refcount += incr;
PutMetaData(&smi);
end_critical_section(S_SUPPMSGMAIN);
smi.meta_refcount += incr;
PutMetaData(&smi);
end_critical_section(S_SUPPMSGMAIN);
- CtdlLogPrintf(CTDL_DEBUG, "msg %ld ref count delta %d, is now %d\n",
+ CtdlLogPrintf(CTDL_DEBUG, "msg %ld ref count delta %+d, is now %d\n",
msgnum, incr, smi.meta_refcount);
/* If the reference count is now zero, delete the message
msgnum, incr, smi.meta_refcount);
/* If the reference count is now zero, delete the message