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

Comparing deliantra/server/ext/map-scheduler.ext (file contents):
Revision 1.38 by root, Mon Jul 23 17:53:55 2007 UTC vs.
Revision 1.39 by root, Sat Jul 28 13:13:36 2007 UTC

8our $SWAP_TIMEOUT = $cf::CFG{swap_timeout} || 300; # number of seconds after which inactive maps get swapped out 8our $SWAP_TIMEOUT = $cf::CFG{swap_timeout} || 300; # number of seconds after which inactive maps get swapped out
9our $SCHEDULE_INTERVAL = $cf::CFG{schedule_interval} || .8; # time the map scheduler sleeps between runs 9our $SCHEDULE_INTERVAL = $cf::CFG{schedule_interval} || .8; # time the map scheduler sleeps between runs
10our $SAVE_TIMEOUT = $cf::CFG{save_timeout} || 30; # save maps every n seconds 10our $SAVE_TIMEOUT = $cf::CFG{save_timeout} || 30; # save maps every n seconds
11our $SWAP_LOAD1 = $cf::CFG{swap_load1} || .1; # start aggressively swapping at this load 11our $SWAP_LOAD1 = $cf::CFG{swap_load1} || .1; # start aggressively swapping at this load
12our $SWAP_LOAD2 = $cf::CFG{swap_load2} || .4; # swap as fast as possible at this load 12our $SWAP_LOAD2 = $cf::CFG{swap_load2} || .4; # swap as fast as possible at this load
13
14warn "load1 ", $SWAP_LOAD1;#d#
15warn "load2 ", $SWAP_LOAD2;#d#
13 16
14cf::async_ext { 17cf::async_ext {
15 $Coro::current->prio (Coro::PRIO_MIN); 18 $Coro::current->prio (Coro::PRIO_MIN);
16 19
17 # load the header of swapped-out maps. 20 # load the header of swapped-out maps.
82 85
83 if ($map->last_access + $max_idle <= $cf::RUNTIME && !$map->players) { 86 if ($map->last_access + $max_idle <= $cf::RUNTIME && !$map->players) {
84 $map->swap_out; 87 $map->swap_out;
85 } elsif ($map->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { 88 } elsif ($map->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) {
86 $map->save; 89 $map->save;
90 $map->{last_save} -= rand; # randomise map save times a bit
87 } 91 }
88 } 92 }
89 }; 93 };
90 warn $@ if $@; 94 warn $@ if $@;
91 cf::cede_to_tick; 95 cf::cede_to_tick;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines