… | |
… | |
76 | # delete $map->{active}; |
76 | # delete $map->{active}; |
77 | # } |
77 | # } |
78 | if ($map->should_reset) { |
78 | if ($map->should_reset) { |
79 | $map->reset; |
79 | $map->reset; |
80 | } elsif ($map->in_memory == cf::MAP_IN_MEMORY) { |
80 | } elsif ($map->in_memory == cf::MAP_IN_MEMORY) { |
81 | my $max_idle = cf::clamp +(cf::lerp $cf::LOADAVG, $SWAP_LOAD1, $SWAP_LOAD2, $SWAP_TIMEOUT, 0), 0, $SWAP_TIMEOUT; |
81 | my $max_idle = cf::clamp +(cf::lerp $cf::LOADAVG, $SWAP_LOAD1, $SWAP_LOAD2, $SWAP_TIMEOUT, $cf::TICK * 1.5), |
|
|
82 | $cf::TICK * 1.5, $SWAP_TIMEOUT; |
82 | |
83 | |
83 | if ($map->last_access + $max_idle <= $cf::RUNTIME && !$map->players) { |
84 | if ($map->last_access + $max_idle <= $cf::RUNTIME && !$map->players) { |
84 | $map->swap_out; |
85 | $map->swap_out; |
85 | } elsif ($map->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
86 | } elsif ($map->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
86 | $map->save; |
87 | $map->save; |