--- deliantra/server/ext/map-scheduler.ext 2007/01/04 16:19:32 1.11 +++ deliantra/server/ext/map-scheduler.ext 2007/01/05 17:07:17 1.15 @@ -9,6 +9,26 @@ our $SAVE_TIMEOUT = 20; # save maps every n seconds our $SAVE_INTERVAL = 0.1; # save at max. one map every $SAVE_INTERVAL +cf::coro { + $Coro::current->prio (Coro::PRIO_MIN); + # load the header of swapped-out maps. + # this is not a correctness issue, it simply saves diskspace + # because old files will get cleaned up on reset time + Coro::Timer::sleep 5; + + my $files = Coro::AIO::aio_readdir cf::localdir . "/" . cf::tmpdir; + + for my $map (@$files) { + utf8::decode $map; + next if $map =~ /\.(?:pst|meta)$/; + $map =~ s/∕/\//g; + cf::map::find $map; + Coro::Timer::sleep 0.05; + } + + #TODO: should also preload random maps... +}; + our $SCHEDULER = cf::coro { while () { Coro::Timer::sleep $SCHEDULE_INTERVAL; @@ -50,12 +70,13 @@ $SCHEDULER->prio (-2); -# map load prefetch +# map load prefetch for tiled maps, possibly exits, too cf::map->attach ( on_enter => sub { my ($map, $pl) = @_; - # floodfill surrounging maps, asynchronously +# warn "$pl $map->{path}{path}\n";#d# + # floodfill surrounding maps, asynchronously }, );