… | |
… | |
6 | |
6 | |
7 | our $DEACTIVATE_TIMEOUT = 20; # number of seconds after which maps get deactivated to save cpu |
7 | our $DEACTIVATE_TIMEOUT = 20; # number of seconds after which maps get deactivated to save cpu |
8 | our $SWAP_TIMEOUT = 35; # number of seconds after which maps inactive get swapped out |
8 | our $SWAP_TIMEOUT = 35; # number of seconds after which maps inactive get swapped out |
9 | our $SCHEDULE_INTERVAL = 2; # time the map scheduler sleeps between runs |
9 | our $SCHEDULE_INTERVAL = 2; # time the map scheduler sleeps between runs |
10 | our $SAVE_TIMEOUT = 20; # save maps every n seconds |
10 | our $SAVE_TIMEOUT = 20; # save maps every n seconds |
11 | our $SAVE_INTERVAL = 0.1; # save at max. one map every $SAVE_INTERVAL |
11 | our $SAVE_INTERVAL = 0.2; # save at max. one map every $SAVE_INTERVAL |
12 | |
12 | |
13 | cf::async_ext { |
13 | cf::async_ext { |
14 | $Coro::current->prio (Coro::PRIO_MIN); |
14 | $Coro::current->prio (Coro::PRIO_MIN); |
15 | # load the header of swapped-out maps. |
15 | # load the header of swapped-out maps. |
16 | # this is not a correctness issue, it simply saves diskspace |
16 | # this is not a correctness issue, it simply saves diskspace |
… | |
… | |
22 | for my $map (@$files) { |
22 | for my $map (@$files) { |
23 | utf8::decode $map; |
23 | utf8::decode $map; |
24 | next if $map =~ /\.(?:pst|meta)$/; |
24 | next if $map =~ /\.(?:pst|meta)$/; |
25 | $map =~ s/∕/\//g; |
25 | $map =~ s/∕/\//g; |
26 | cf::map::find $map; |
26 | cf::map::find $map; |
27 | Coro::Timer::sleep 0.05; |
27 | Coro::Timer::sleep 0.3; |
28 | } |
28 | } |
29 | |
29 | |
30 | #TODO: should also preload random maps... |
30 | #TODO: should also preload random maps... |
31 | }; |
31 | }; |
32 | |
32 | |