Changeset 27399
- Timestamp:
- 2013-05-23T13:39:24+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/tdb-edit/trunk/src/perllib/dbutil/tdbserver.pm
r26996 r27399 67 67 } 68 68 69 my $we_started_server = 0; 69 70 my $server_lockfile_path = &util::filename_cat($ENV{'GSDLHOME'},'collect',$collection,'tmp','tdbserver.lock'); 70 71 print " * Searching for TDBServer lockfile...\n"; … … 81 82 if (!-e $server_lockfile_path) 82 83 { 84 $we_started_server = 1; 83 85 # ...start it! 84 86 my $launch_cmd = 'TDBServer.pl "' . $$ . '" "' . $collection . '"'; … … 90 92 my $line = ''; 91 93 my $server_lock_file_created = 0; 94 autoflush STDOUT 1; 95 print "* Waiting for TDBServer to start"; 92 96 my $server_host = ''; 93 97 my $server_port = ''; 94 98 while ($line = <SERVERIN>) 95 99 { 100 print "."; 96 101 # - watch for the line indicating a lock file has been created and 97 102 # populated with a sexy port number … … 115 120 } 116 121 close(SERVERIN); 122 print "\n"; 117 123 if (!$server_lock_file_created) 118 124 { … … 136 142 # record this for later 137 143 $listener_server_lockfile_paths{$server_lockfile_path} = $infodb_file_path; 138 return TDBClient->new($server_lockfile_path, $infodb_file );144 return TDBClient->new($server_lockfile_path, $infodb_file, $we_started_server); 139 145 } 140 146 … … 162 168 # we should now wait until all of our server_lockfiles have actually been 163 169 # removed (otherwise people could mistakenly run import/build again 164 # immediately and things *might* go pearshaped). 165 # - actually, if they try to run again while TDB is still running, it will 166 # detect an existing lockfile and immediately quit. So maybe waiting 167 # isn't as important as I originally thought. I'll comment it out for now. 168 # foreach my $server_lockfile_path (keys (%created_server_lockfile_paths)) 169 # { 170 # # While the file exists, we should wait 171 # print "* Waiting for TDBServer [" . $server_lockfile_path . "] to exit..."; 172 # if (-e $server_lockfile_path) 173 # { 174 # while (-e $server_lockfile_path) 175 # { 176 # print "."; 177 # sleep(1); 178 # } 179 # } 180 # print " Done!\n"; 181 # } 170 # immediately and things *might* go pearshaped). (Subsequent testing shows it 171 # won't - a new Greenstone build can't start until the previous lockfile is 172 # removed - but I think, for ATOMic sake, I may as well make waiting a part 173 # of the Greenstone import/build time. 174 my $wait_for_exit = 1; 175 foreach my $server_lockfile_path (keys (%created_server_lockfile_paths)) 176 { 177 if ($wait_for_exit) 178 { 179 # While the file exists, we should wait 180 autoflush STDOUT 1; 181 print "* Waiting for TDBServer to exit [" . $server_lockfile_path . "]"; 182 if (-e $server_lockfile_path) 183 { 184 while (-e $server_lockfile_path) 185 { 186 print "."; 187 sleep(1); 188 } 189 } 190 } 191 else 192 { 193 print "* NOT Waiting for TDBServer to exit... "; 194 } 195 print " Done!\n"; 196 } 182 197 } 183 198
Note:
See TracChangeset
for help on using the changeset viewer.