Prechádzať zdrojové kódy

Remove potential busy wait for remote stores

Jonas Borgström 14 rokov pred
rodič
commit
8dc057a70e
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      darc/remote.py

+ 3 - 3
darc/remote.py

@@ -108,9 +108,9 @@ class RemoteStore(object):
         self.msgid = 0
         self.msgid = 0
         self.id, self.tid = self.cmd('open', (location.path, create))
         self.id, self.tid = self.cmd('open', (location.path, create))
 
 
-    def wait(self):
+    def wait(self, write=True):
         with self.channel.lock:
         with self.channel.lock:
-            if (self.channel.out_window_size == 0 and
+            if ((not write or self.channel.out_window_size == 0) and
                 not self.channel.recv_ready() and
                 not self.channel.recv_ready() and
                 not self.channel.recv_stderr_ready()):
                 not self.channel.recv_stderr_ready()):
                 self.channel.out_buffer_cv.wait(10)
                 self.channel.out_buffer_cv.wait(10)
@@ -145,7 +145,7 @@ class RemoteStore(object):
                 if not odata and callback:
                 if not odata and callback:
                     return
                     return
             else:
             else:
-                self.wait()
+                self.wait(odata)
 
 
     def commit(self, *args):
     def commit(self, *args):
         self.cmd('commit', args)
         self.cmd('commit', args)