ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/schmorplog.ext
(Generate patch)

Comparing deliantra/server/ext/schmorplog.ext (file contents):
Revision 1.31 by root, Sat Feb 4 00:14:41 2012 UTC vs.
Revision 1.32 by root, Sat Feb 4 00:41:42 2012 UTC

4 4
5use Fcntl; 5use Fcntl;
6use Coro::AIO; 6use Coro::AIO;
7 7
8CONF EXPORT_RECENTLOG = undef 8CONF EXPORT_RECENTLOG = undef
9CONF EXPORT_RECENTLOG_INTERVAL = 0.5 9CONF EXPORT_RECENTLOG_INTERVAL = 300
10 10
11############################################################################# 11#############################################################################
12# stuffs 12# stuffs
13 13
14our %PLAYERSEEN; 14our %PLAYERSEEN;
261 my $t0 = EV::now; 261 my $t0 = EV::now;
262 262
263 $Coro::current->nice (1); 263 $Coro::current->nice (1);
264 $Coro::current->{desc} = "recentlog updater"; 264 $Coro::current->{desc} = "recentlog updater";
265 265
266 Coro::AnyEvent::sleep 5; # grace time to allow file-saves
267
266 my $lock = cf::lock_acquire "export_recentlog"; 268 my $lock = cf::lock_acquire "export_recentlog";
267 269
268 while (%need_update) { 270 while (%need_update) {
269 for (keys %need_update) { 271 for (keys %need_update) {
270 delete $need_update{$_}; 272 delete $need_update{$_};
271 273
272 _update_login $_; 274 _update_login $_;
273 } 275 }
274 } 276 }
277
278 undef $update_w;
275 279
276 cf::get_slot 0.1, 0, "recentlog serialise"; 280 cf::get_slot 0.1, 0, "recentlog serialise";
277 281
278 my $NOW = $cf::NOW; 282 my $NOW = $cf::NOW;
279 283
282 date => $NOW, 286 date => $NOW,
283 data => [ 287 data => [
284 sort { ($b->[4] || $NOW) <=> ($a->[4] || $NOW) } 288 sort { ($b->[4] || $NOW) <=> ($a->[4] || $NOW) }
285 values %RECENT 289 values %RECENT
286 ], 290 ],
287 }; 291 } or warn "$EXPORT_RECENTLOG: $!";
288 292
289 cf::trace "recentlog updated (", EV::now - $t0, "s).\n"; 293 cf::trace "recentlog updated (", EV::now - $t0, "s).\n";
290 }; 294 };
291} 295}
292 296
312 _update; 316 _update;
313 }; 317 };
314} 318}
315 319
316cf::player->attach ( 320cf::player->attach (
317 on_login => sub { undef $need_update{$_[0]->ob->name}; _update }, 321 on_login => sub { undef $need_update{$_[0]->ob->name}; update },
318 on_logout => sub { undef $need_update{$_[0]->ob->name}; _update }, 322 on_logout => sub { undef $need_update{$_[0]->ob->name}; update },
319 on_birth => sub { undef $need_update{$_[0]->ob->name}; _update }, 323 on_birth => sub { undef $need_update{$_[0]->ob->name}; update },
320 on_death => sub { undef $need_update{$_[0]->ob->name}; _update }, 324 on_death => sub { undef $need_update{$_[0]->ob->name}; update },
321 on_load => sub { undef $need_update{$_[0]->ob->name}; _update }, 325# on_load => sub { undef $need_update{$_[0]->ob->name}; update },
322 on_save => sub { undef $need_update{$_[0]->ob->name}; _update }, 326# on_save => sub { undef $need_update{$_[0]->ob->name}; update },
323); 327);
324 328
325cf::post_init { 329cf::post_init {
326 reload; 330 reload;
327}; 331};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines