Exemple #1
0
/**
 * Checks cleanup time and performs cleanup if needed
 *
 * Most of this stuff is done at the period DB dump time.  This is
 * separate so it can be run more often for machines with memory
 * constraints.
 *
 *   - purge_for_pool @see purge_for_pool
 *   - free_unused_programs (if tp_period_program_purge)
 *     @see free_unused_programs
 *   - dispose_all_oldprops (if DISKBASE) @see dispose_all_oldprops
 *
 * @private
 */
static void
check_clean_time(void)
{
    time_t currtime = (time_t) time((time_t *) NULL);

    /*
     * @TODO Total overlap with next_clean_time -- use that to
     * calculate if we need to clean or not.
     */
    if (!last_clean_time)
        last_clean_time = (time_t) time((time_t *) NULL);

    if ((last_clean_time + tp_clean_interval) < currtime) {
        last_clean_time = currtime;
        purge_for_pool();

        /*
         * @TODO purge_try_pool() as well?  That is done at dump time but
         *       but not here.  Not sure how much it matters.  Update
         *       the header if you fix this.
         */

        if (tp_periodic_program_purge)
            free_unused_programs();

#ifdef DISKBASE
        dispose_all_oldprops();
#endif
    }
}
Exemple #2
0
void
check_dump_time(void)
{
	long currtime = (long) time((time_t *) NULL);

	if (!last_dump_time)
		last_dump_time = (long) time((time_t *) NULL);

	if (!dump_warned) {
		if (((last_dump_time + tp_dump_interval) - tp_dump_warntime)
			< currtime) {
			dump_warning();
			dump_warned = 1;
		}
	}

	if ((last_dump_time + tp_dump_interval) < currtime) {
		last_dump_time = currtime;
		add_property((dbref) 0, "_sys/lastdumptime", NULL, (int) currtime);

		if (tp_periodic_program_purge)
			free_unused_programs();
		purge_for_pool();
		purge_try_pool();

#ifdef DELTADUMPS
		dump_deltas();
#else
		fork_and_dump();
#endif

		dump_warned = 0;
	}
}
Exemple #3
0
void
check_clean_time(void)
{
	long currtime = (long) time((time_t *) NULL);

	if (!last_clean_time)
		last_clean_time = (long) time((time_t *) NULL);

	if ((last_clean_time + tp_clean_interval) < currtime) {
		last_clean_time = currtime;
		purge_for_pool();
		if (tp_periodic_program_purge)
			free_unused_programs();
#ifdef DISKBASE
		dispose_all_oldprops();
#endif
	}
}
Exemple #4
0
/**
 * Checks if its time to take a dump, among other things.
 *
 * If its time to dump, we also:
 *
 *   * set a last dumped at property
 *   * free unused programs (@see free_unused_programs) if enabled
 *   * purge_for_pool and purge_try_pool
 *     (@see purge_for_pool @see purge_try_pool)
 *
 * The actual dump is fork_and_dump ... @see fork_and_dump
 *
 * @private
 */
static void
check_dump_time(void)
{
    time_t currtime = (time_t) time((time_t *) NULL);

    if (!last_dump_time)
        last_dump_time = (time_t) time((time_t *) NULL);

    /*
     * @TODO There is a lot of overlap here in calculating times
     *       with next_dump_time -- this function should use
     *       next_dump_time instead of having copy-paste versions of
     *       all the code in next_dump_time
     */

    if (!dump_warned) {
        if (((last_dump_time + tp_dump_interval) - tp_dump_warntime)
            < currtime) {
            dump_warning();
            dump_warned = 1;
        }
    }

    if ((last_dump_time + tp_dump_interval) < currtime) {
        last_dump_time = currtime;
        add_property((dbref) 0, SYS_LASTDUMPTIME_PROP, NULL, (int) currtime);

        if (tp_periodic_program_purge)
            free_unused_programs();

        purge_for_pool();
        purge_try_pool();

        fork_and_dump();

        dump_warned = 0;
    }
}