diff options
Diffstat (limited to 'subcmds/sync.py')
| -rw-r--r-- | subcmds/sync.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index decf559b..8e4dde6b 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -821,6 +821,16 @@ later is required to fix a server side protocol bug. | |||
| 821 | jobs = jobs_str(len(items)) | 821 | jobs = jobs_str(len(items)) |
| 822 | return f"{jobs} | {elapsed_str(elapsed)} {earliest_proj}" | 822 | return f"{jobs} | {elapsed_str(elapsed)} {earliest_proj}" |
| 823 | 823 | ||
| 824 | @classmethod | ||
| 825 | def InitWorker(cls): | ||
| 826 | # Force connect to the manager server now. | ||
| 827 | # This is good because workers are initialized one by one. Without this, | ||
| 828 | # multiple workers may connect to the manager when handling the first | ||
| 829 | # job at the same time. Then the connection may fail if too many | ||
| 830 | # connections are pending and execeeded the socket listening backlog, | ||
| 831 | # especially on MacOS. | ||
| 832 | len(cls.get_parallel_context()["sync_dict"]) | ||
| 833 | |||
| 824 | def _Fetch(self, projects, opt, err_event, ssh_proxy, errors): | 834 | def _Fetch(self, projects, opt, err_event, ssh_proxy, errors): |
| 825 | ret = True | 835 | ret = True |
| 826 | 836 | ||
| @@ -913,6 +923,7 @@ later is required to fix a server side protocol bug. | |||
| 913 | # idle while other workers still have more than one job in | 923 | # idle while other workers still have more than one job in |
| 914 | # their chunk queue. | 924 | # their chunk queue. |
| 915 | chunksize=1, | 925 | chunksize=1, |
| 926 | initializer=self.InitWorker, | ||
| 916 | ) | 927 | ) |
| 917 | finally: | 928 | finally: |
| 918 | sync_event.set() | 929 | sync_event.set() |
