speed up autoupdate a bit?

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

speed up autoupdate a bit?

#1 Post by Technology »

Wrote this quick because i was annoyed with the duration of the svn update checks.

Code: Select all

Index: autoupdate.pl
===================================================================
--- autoupdate.pl	(revision 7277)
+++ autoupdate.pl	(working copy)
@@ -18,6 +18,7 @@
 
 use Time::HiRes qw(time usleep);
 use Carp::Assert;
+use Thread qw(async);
 
 # Update base
 use SVN::Updater;
@@ -37,7 +38,7 @@
 	
 	return unless -d "$path/.svn" && !-l $path;
 	
-	print "Checking " . $repos_name . " for updates...";
+	my $message = "Checking " . $repos_name . " for updates...\n";
 	my $sa = SVN::Updater->load({ path => $path });
 
 	my (undef, $old_version) = $sa->info;
@@ -45,18 +46,22 @@
 	my (undef, $new_version) = $sa->info;
 	
 	if ($old_version == $new_version) {
-		print " no updates available\n";
+		$message .= " no updates available\n";
 	} else {
-		print " updated to r$new_version\n";
+		$message .= " updated to r$new_version\n";
 	}
+	print $message;
 };
 
 print "-===================== OpenKore Auto Update tool =====================-\n";
 if (check_svn_util() == 1) {
-	upgrade("$RealBin", "OpenKore core files");
-	upgrade("$RealBin/tables", "OpenKore table data files");
-	upgrade("$RealBin/fields", "OpenKore map data files");
-	upgrade($_, $_) while <$RealBin/plugins/*>;
+	my @async = (
+		async { upgrade("$RealBin", "OpenKore core files") },
+		async { upgrade("$RealBin/tables", "OpenKore table data files") },
+		async { upgrade("$RealBin/fields", "OpenKore map data files") },
+	);
+	push @async, async { upgrade($_, $_) } while <$RealBin/plugins/*>;
+	$_->join foreach (@async);
 };status
 print "-=========================== Done Updating ===========================-\n\n\n";
 
This might give problems with warning messages etc so see this as a proof of concept...
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: speed up autoupdate a bit?

#2 Post by kLabMouse »

Perl Threads could break Wx.
So better do not include them.

for this point, Coro is better, but need alot of work to make normal thread like behavior.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: speed up autoupdate a bit?

#3 Post by EternalHarvest »

Btw autoupdate on windows is really slow, and also can break working copy in a such way that svn cleanup won't help.

Locked