1 | #! perl # mandatory |
1 | #! perl # mandatory |
2 | |
2 | |
3 | our $SCHEDULE_INTERVAL = $cf::CFG{extractor_schedule_interval} || 3600; |
3 | CONF SCHEDULE_INTERVAL : extractor_schedule_interval = 3600; |
4 | |
4 | |
5 | use JSON::XS; |
5 | use JSON::XS; |
6 | |
6 | |
7 | our $db_mapinfo = cf::sync_job { cf::db_table "tag-mapinfo" }; # info/cache for maps |
7 | our $db_mapinfo = cf::db_table "tag-mapinfo"; # info/cache for maps |
8 | our $db_target = cf::sync_job { cf::db_table "tag-target" }; # tag => maps |
8 | our $db_target = cf::db_table "tag-target"; # tag => maps |
9 | |
9 | |
10 | sub remove_tag_target { |
10 | sub remove_tag_target { |
11 | my ($txn, $tag, $target) = @_; |
11 | my ($txn, $tag, $target) = @_; |
12 | # - U O |
12 | # - U O |
13 | |
13 | |
… | |
… | |
70 | |
70 | |
71 | # we don't actually care if it succeeds or not, as we |
71 | # we don't actually care if it succeeds or not, as we |
72 | # will just retry an hour later |
72 | # will just retry an hour later |
73 | BDB::db_txn_finish $txn; |
73 | BDB::db_txn_finish $txn; |
74 | |
74 | |
75 | warn "tag-updated $file (= $key) <@tags>\n" |
75 | cf::debug "tag-updated $file (= $key) <@tags>\n" |
76 | if @tags; |
76 | if @tags; |
77 | } |
77 | } |
78 | |
78 | |
79 | sub scan_static { |
79 | sub scan_static { |
80 | my $maps = cf::map::static_maps; |
80 | my $maps = cf::map::static_maps; |
… | |
… | |
126 | |
126 | |
127 | # now hunt for all per-player maps |
127 | # now hunt for all per-player maps |
128 | # scan_dir $cf::PLAYERDIR |
128 | # scan_dir $cf::PLAYERDIR |
129 | # for my $login (@{ cf::player::list_logins or [] }) { |
129 | # for my $login (@{ cf::player::list_logins or [] }) { |
130 | # for my $path (@{ cf::player::maps $login or [] }) { |
130 | # for my $path (@{ cf::player::maps $login or [] }) { |
131 | # cf::cede_to_tick; |
|
|
132 | # |
131 | # |
133 | # $path =~ /^~[^\/]+(\/.*)$/ |
132 | # $path =~ /^~[^\/]+(\/.*)$/ |
134 | # or next; # doh |
133 | # or next; # doh |
135 | # |
134 | # |
136 | # my $base = cf::map::find $1; |
135 | # my $base = cf::map::find $1; |
… | |
… | |
149 | # delete $map->{deny_reset}; |
148 | # delete $map->{deny_reset}; |
150 | # } |
149 | # } |
151 | # } |
150 | # } |
152 | # } |
151 | # } |
153 | |
152 | |
154 | warn sprintf "map-tag scan finished (%fs)\n", AE::time - $start; |
153 | cf::info sprintf "map-tag scan finished (%fs)\n", AE::time - $start; |
155 | } |
154 | } |
156 | |
155 | |
157 | our $RELOAD_SCHEDULER = cf::periodic $SCHEDULE_INTERVAL, Coro::unblock_sub { |
156 | our $RELOAD_SCHEDULER = cf::periodic $SCHEDULE_INTERVAL, Coro::unblock_sub { |
158 | $Coro::current->prio (Coro::PRIO_MIN); |
157 | $Coro::current->prio (Coro::PRIO_MIN); |
159 | $Coro::current->desc ("map-tag scanner"); |
158 | $Coro::current->desc ("map-tag scanner"); |
… | |
… | |
183 | my $guard = cf::lock_acquire "map-tags::reload"; |
182 | my $guard = cf::lock_acquire "map-tags::reload"; |
184 | |
183 | |
185 | BDB::db_close $db_target; |
184 | BDB::db_close $db_target; |
186 | BDB::db_close $db_mapinfo; |
185 | BDB::db_close $db_mapinfo; |
187 | } |
186 | } |
|
|
187 | |