Remove job queue used by noone
cleanup unused tracers remove svn cleanup script
This commit is contained in:
parent
323fb24b10
commit
8c9c02f45f
@ -90,10 +90,6 @@ dbg_mobf = {
|
||||
mobf_core_lvl2 = function () end,
|
||||
mobf_core_lvl3 = function () end,
|
||||
|
||||
mob_preserve_lvl1 = function () end,
|
||||
mob_preserve_lvl2 = function () end,
|
||||
mob_preserve_lvl3 = function () end,
|
||||
|
||||
mobf_core_helper_lvl1 = function () end,
|
||||
mobf_core_helper_lvl2 = function () end,
|
||||
mobf_core_helper_lvl3 = function () end,
|
||||
|
@ -74,7 +74,6 @@ dofile (mobf_modpath .. "/utils/data_storage.lua")
|
||||
dofile (mobf_modpath .. "/utils/tracing.lua")
|
||||
dofile (mobf_modpath .. "/utils/geometry.lua")
|
||||
dofile (mobf_modpath .. "/utils/permanent_data.lua")
|
||||
dofile (mobf_modpath .. "/job_queue.lua")
|
||||
dofile (mobf_modpath .. "/lifebar.lua")
|
||||
dofile (mobf_modpath .. "/env_constants.lua")
|
||||
dofile (mobf_modpath .. "/environment.lua")
|
||||
@ -168,9 +167,6 @@ function mobf_init_framework()
|
||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize statistics...")
|
||||
mobf_init_statistics()
|
||||
|
||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize asynchronous job handling...")
|
||||
mobf_job_queue.initialize()
|
||||
|
||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize factions support...")
|
||||
mobf_factions.init()
|
||||
|
||||
|
@ -1,115 +0,0 @@
|
||||
-------------------------------------------------------------------------------
|
||||
-- Mob Framework Mod by Sapier
|
||||
--
|
||||
-- You may copy, use, modify or do nearly anything except removing this
|
||||
-- copyright notice.
|
||||
-- And of course you are NOT allow to pretend you have written it.
|
||||
--
|
||||
--! @file job_queue.lua
|
||||
--! @brief asynchronous job queue
|
||||
--! @copyright Sapier
|
||||
--! @author Sapier
|
||||
--! @date 2013-08-18
|
||||
--
|
||||
-- Contact sapier a t gmx net
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
mobf_assert_backtrace(mobf_job_queue == nil)
|
||||
|
||||
--! @class mobf_job_queue
|
||||
--! @brief delayed job handling features
|
||||
mobf_job_queue = {}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- @function [parent=#mobf_job_queue] add_job(job)
|
||||
--
|
||||
--! @brief queue a job to asynchronous job handling
|
||||
--! @memberof mobf_job_queue
|
||||
--
|
||||
--! @param job to do
|
||||
-------------------------------------------------------------------------------
|
||||
function mobf_job_queue.add_job(job)
|
||||
table.insert(mobf_job_queue.queue, job)
|
||||
|
||||
mobf_get_statistics().data.queue.max =
|
||||
MAX(mobf_get_statistics().data.queue.max,#mobf_job_queue.queue)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- @function [parent=#mobf_job_queue] process(dtime)
|
||||
--
|
||||
--! @brief job processing handler
|
||||
--! @memberof mobf_job_queue
|
||||
--
|
||||
--! @param dtime time since last call
|
||||
-------------------------------------------------------------------------------
|
||||
function mobf_job_queue.process(dtime)
|
||||
local starttime = mobf_get_time_ms()
|
||||
mobf_job_queue.current_interval = mobf_job_queue.current_interval + dtime
|
||||
|
||||
if mobf_job_queue.current_interval < mobf_job_queue.queue_interval then
|
||||
return
|
||||
end
|
||||
|
||||
mobf_job_queue.current_interval = 0
|
||||
|
||||
local jobs_processed = 0
|
||||
|
||||
local jobs_before = #mobf_job_queue.queue
|
||||
|
||||
while (#mobf_job_queue.queue > 0) and
|
||||
(mobf_get_time_ms() - starttime) < MIN(20,mobf_step_quota.remaining()) do
|
||||
local action = table.remove(mobf_job_queue.queue)
|
||||
|
||||
mobf_assert_backtrace(type(action.callback) == "function")
|
||||
action.callback(action.data)
|
||||
jobs_processed = jobs_processed + 1
|
||||
end
|
||||
mobf_warn_long_fct(starttime,"job_processing","delayed_processing")
|
||||
-- print("Queue processed " .. jobs_processed .. " of " .. jobs_before
|
||||
-- .. " jobs in " .. string.format("%4.2f",(mobf_get_time_ms() - starttime)) .. "ms")
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- @function [parent=#mobf_job_queue] cleanup()
|
||||
--
|
||||
--! @brief handle all jobs queued
|
||||
--! @memberof mobf_job_queue
|
||||
--
|
||||
-------------------------------------------------------------------------------
|
||||
function mobf_job_queue.cleanup()
|
||||
local starttime = mobf_get_time_ms()
|
||||
local processed = 0
|
||||
while (#mobf_job_queue.queue > 0) do
|
||||
if processed % 10 == 0 then
|
||||
--TODO log and broadcast
|
||||
end
|
||||
|
||||
local action = table.remove(mobf_job_queue.queue)
|
||||
|
||||
mobf_assert_backtrace(type(action.callback) == "function")
|
||||
action.callback(action.data)
|
||||
|
||||
processed = processed + 1
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- @function [parent=#mobf_job_queue] initialize()
|
||||
--
|
||||
--! @brief initialize job queue
|
||||
--! @memberof mobf_job_queue
|
||||
--
|
||||
-------------------------------------------------------------------------------
|
||||
function mobf_job_queue.initialize(queue_interval)
|
||||
|
||||
mobf_job_queue.queue = {}
|
||||
mobf_job_queue.current_interval = 0
|
||||
mobf_job_queue.queue_interval = queue_interval or 0.040
|
||||
|
||||
--register async handler to global step
|
||||
minetest.register_globalstep(mobf_job_queue.process)
|
||||
|
||||
--register cleanup handler
|
||||
minetest.register_on_shutdown(mobf_job_queue.cleanup)
|
||||
end
|
@ -1,2 +0,0 @@
|
||||
#cleanup via find
|
||||
# find . -name .svn -exec rm -r {} \;
|
@ -121,8 +121,6 @@ function mobf_statistic_calc(dtime)
|
||||
statistics.data.mobs.current = active_mobs
|
||||
statistics.data.mobs.max = MAX(statistics.data.mobs.max,active_mobs)
|
||||
|
||||
statistics.data.queue.current = #mobf_job_queue.queue
|
||||
|
||||
statistics.data.user_1.current = current_user_1
|
||||
statistics.data.user_1.maxabs = MAX(statistics.data.user_1.maxabs, math.floor(current_user_1*refresh_interval))
|
||||
statistics.data.user_1.max = MAX(statistics.data.user_1.max,current_user_1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user