--- deliantra/server/ext/map-tags.ext 2007/09/13 16:16:36 1.7 +++ deliantra/server/ext/map-tags.ext 2007/12/02 15:16:28 1.12 @@ -81,7 +81,8 @@ # will just retry an hour later BDB::db_txn_finish $txn; -# warn "tag-updated $file (= $key) $hash\n";#d# + warn "tag-updated $file (= $key) <@tags>\n" + if @tags; } sub scan_static { @@ -103,7 +104,9 @@ } sub reload { - my $start = Event::time; + my $guard = cf::lock_acquire "map-tags::reload"; + + my $start = EV::time; # 1. check for maps no longer existing { @@ -168,18 +171,16 @@ # } # } - warn sprintf "map-tag scan (%fs)", Event::time - $start; + warn sprintf "map-tag scan (%fs)", EV::time - $start; } -our $RELOAD_SCHEDULER = Event->timer ( - after => 0, - interval => $SCHEDULE_INTERVAL, - data => cf::WF_AUTOCANCEL, - cb => Coro::unblock_sub { - $Coro::current->prio (Coro::PRIO_MIN); - reload; - }, -); +our $RELOAD_SCHEDULER = cf::periodic $SCHEDULE_INTERVAL, Coro::unblock_sub { + $Coro::current->prio (Coro::PRIO_MIN); + $Coro::current->desc ("map-tag scanner"); + reload; +}; + +cf::async { reload }; # force at startup # find all objects with the given tag, or at least try to sub find($) {