diff --git a/code/__DEFINES/qdel.dm b/code/__DEFINES/qdel.dm index 8714f555274..d6a08b3174f 100644 --- a/code/__DEFINES/qdel.dm +++ b/code/__DEFINES/qdel.dm @@ -24,9 +24,17 @@ #define QDEL_HINT_IFFAIL_FINDREFERENCE 6 #endif -#define GC_QUEUE_CHECK 1 -#define GC_QUEUE_HARDDELETE 2 -#define GC_QUEUE_COUNT 2 //increase this when adding more steps. +// Defines for the ssgarbage queues +#define GC_QUEUE_FILTER 1 //! short queue to filter out quick gc successes so they don't hang around in the main queue for 5 minutes +#define GC_QUEUE_CHECK 2 //! main queue that waits 5 minutes because thats the longest byond can hold a reference to our shit. +#define GC_QUEUE_HARDDELETE 3 //! short queue for things that hard delete instead of going thru the gc subsystem, this is purely so if they *can* softdelete, they will soft delete rather then wasting time with a hard delete. +#define GC_QUEUE_COUNT 3 //! Number of queues, used for allocating the nested lists. Don't forget to increase this if you add a new queue stage + +// Defines for the time an item has to get its reference cleaned before it fails the queue and moves to the next. +#define GC_FILTER_QUEUE 1 SECONDS +#define GC_CHECK_QUEUE 5 MINUTES +#define GC_DEL_QUEUE 10 SECONDS + #define QDEL_ITEM_ADMINS_WARNED (1<<0) //! Set when admins are told about lag causing qdels in this type. #define QDEL_ITEM_SUSPENDED_FOR_LAG (1<<1) //! Set when a type can no longer be hard deleted on failure because of lag it causes while this happens. @@ -35,10 +43,6 @@ #define GC_QUEUED_FOR_QUEUING -1 #define GC_CURRENTLY_BEING_QDELETED -2 -// Defines for the time left for an item to get its reference cleaned -#define GC_FILTER_QUEUE 5 MINUTES -#define GC_DEL_QUEUE 10 SECONDS - #define QDELING(X) (X.gc_destroyed) #define QDELETED(X) (!X || QDELING(X)) #define QDESTROYING(X) (!X || X.gc_destroyed == GC_CURRENTLY_BEING_QDELETED) diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index 7f7d301a1d1..b49256d2b11 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -29,7 +29,7 @@ SUBSYSTEM_DEF(garbage) runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY init_order = INIT_ORDER_GARBAGE - var/list/collection_timeout = list(GC_FILTER_QUEUE, GC_DEL_QUEUE) // deciseconds to wait before moving something up in the queue to the next level + var/list/collection_timeout = list(GC_FILTER_QUEUE, GC_CHECK_QUEUE, GC_DEL_QUEUE) // deciseconds to wait before moving something up in the queue to the next level //Stat tracking var/delslasttick = 0 // number of del()'s we've done this tick @@ -110,10 +110,13 @@ SUBSYSTEM_DEF(garbage) /datum/controller/subsystem/garbage/fire() //the fact that this resets its processing each fire (rather then resume where it left off) is intentional. - var/queue = GC_QUEUE_CHECK + var/queue = GC_QUEUE_FILTER while (state == SS_RUNNING) switch (queue) + if (GC_QUEUE_FILTER) + HandleQueue(GC_QUEUE_FILTER) + queue = GC_QUEUE_FILTER+1 if (GC_QUEUE_CHECK) HandleQueue(GC_QUEUE_CHECK) queue = GC_QUEUE_CHECK+1 @@ -135,8 +138,8 @@ SUBSYSTEM_DEF(garbage) pass_counts[i] = 0 fail_counts[i] = 0 -/datum/controller/subsystem/garbage/proc/HandleQueue(level = GC_QUEUE_CHECK) - if (level == GC_QUEUE_CHECK) +/datum/controller/subsystem/garbage/proc/HandleQueue(level = GC_QUEUE_FILTER) + if (level == GC_QUEUE_FILTER) delslasttick = 0 gcedlasttick = 0 var/cut_off_time = world.time - collection_timeout[level] //ignore entries newer then this @@ -238,7 +241,7 @@ SUBSYSTEM_DEF(garbage) queue.Cut(1,count+1) count = 0 -/datum/controller/subsystem/garbage/proc/Queue(datum/D, level = GC_QUEUE_CHECK) +/datum/controller/subsystem/garbage/proc/Queue(datum/D, level = GC_QUEUE_FILTER) if (isnull(D)) return if (level > GC_QUEUE_COUNT)