From fb187bb0cee595c3d0b0848aaac4592c25383e5e Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 13 Sep 2013 11:51:07 +0200 Subject: [PATCH] More timeout playing. --- misc/tools/xonotic-map-compiler | 16 +++++++++++++++- misc/tools/xonotic-map-compiler-autobuild | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/misc/tools/xonotic-map-compiler b/misc/tools/xonotic-map-compiler index 371de705..d501437e 100755 --- a/misc/tools/xonotic-map-compiler +++ b/misc/tools/xonotic-map-compiler @@ -60,7 +60,8 @@ my $options = vis_timeout => 0, light_timeout => 0, minimap_timeout => 0, - scale_timeout => 0 + scale_timeout => 0, + timeout_stealing => 0, }; my $curmode = 'maps'; @@ -126,6 +127,10 @@ while(@ARGV) { $options->{scale_timeout} = shift @ARGV; } + elsif($_ eq '-timeout_stealing') + { + $options->{timeout_stealing} = shift @ARGV; + } elsif($_ eq '-order') { $options->{order} = [split /\s*,\s*/, shift @ARGV]; @@ -184,6 +189,8 @@ while(@ARGV) } my $linkdir = File::Temp::tempdir("xonotic-map-compiler.XXXXXX", TMPDIR => 1, CLEANUP => 1); +my $starttime = time; +my $endtime = time; sub q3map2(@) { @@ -195,8 +202,15 @@ sub q3map2(@) $timeout = $options->{minimap_timeout} if $mode eq '-minimap'; $timeout = $options->{scale_timeout} if $mode eq '-scale'; die "Invalid call: not a standard q3map2 stage" if not defined $timeout; + $endtime += $timeout; + my $stolen_timeout = $endtime - time; + if ($stolen_timeout > $timeout) + { + $timeout += ($stolen_timeout - $timeout) * $options->{timeout_stealing}; + } my @args = ($Q3MAP2, split(/\s+/, $Q3MAP2FLAGS), '-game', 'xonotic', '-fs_basepath', $XONOTICDIR, '-fs_basepath', $linkdir, '-v', @_); print "\$ @args\n"; + print "Using timeout: $timeout\n"; defined(my $pid = fork()) or die "fork: $!"; if($pid) # parent diff --git a/misc/tools/xonotic-map-compiler-autobuild b/misc/tools/xonotic-map-compiler-autobuild index 8379cc02..1c9fc7fa 100755 --- a/misc/tools/xonotic-map-compiler-autobuild +++ b/misc/tools/xonotic-map-compiler-autobuild @@ -7,7 +7,7 @@ url_http=http://beta.xonotic.org/autobuild-bsp/ url_ssh=xonotic-beta:autobuild-bsp/ build_cachedir="$HOME/xonotic-map-compiler.cache/" screenshot_cachedir="$HOME/xonotic-map-screenshot.cache/" -build_override="-bsp_timeout 3600 -vis_timeout 10800 -light_timeout 14400 -minimap_timeout 900 -scale_timeout 900" +build_override="-bsp_timeout 3600 -vis_timeout 10800 -light_timeout 18000 -minimap_timeout 900 -scale_timeout 900 -timeout_stealing 0.75" screenshot_override="9 900 5 +g_ctf 1" getthemap_fail=false -- 2.39.2