comparison hgext/lfs/blobstore.py @ 49585:18282cf18aa2

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 14 Nov 2022 10:59:09 +0100
parents 250d9c8aaf10 3556f0392808
children 6543469a351e
comparison
equal deleted inserted replaced
49577:53e4f44ba0e8 49585:18282cf18aa2
599 ) 599 )
600 retry -= 1 600 retry -= 1
601 continue 601 continue
602 raise 602 raise
603 603
604 # Until https multiplexing gets sorted out 604 # Until https multiplexing gets sorted out. It's not clear if
605 # ConnectionManager.set_ready() is externally synchronized for thread
606 # safety with Windows workers.
605 if self.ui.configbool(b'experimental', b'lfs.worker-enable'): 607 if self.ui.configbool(b'experimental', b'lfs.worker-enable'):
608 # The POSIX workers are forks of this process, so before spinning
609 # them up, close all pooled connections. Otherwise, there's no way
610 # to coordinate between them about who is using what, and the
611 # transfers will get corrupted.
612 #
613 # TODO: add a function to keepalive.ConnectionManager to mark all
614 # ready connections as in use, and roll that back after the fork?
615 # That would allow the existing pool of connections in this process
616 # to be preserved.
617 def prefork():
618 for h in self.urlopener.handlers:
619 getattr(h, "close_all", lambda: None)()
620
606 oids = worker.worker( 621 oids = worker.worker(
607 self.ui, 622 self.ui,
608 0.1, 623 0.1,
609 transfer, 624 transfer,
610 (), 625 (),
611 sorted(objects, key=lambda o: o.get(b'oid')), 626 sorted(objects, key=lambda o: o.get(b'oid')),
627 prefork=prefork,
612 ) 628 )
613 else: 629 else:
614 oids = transfer(sorted(objects, key=lambda o: o.get(b'oid'))) 630 oids = transfer(sorted(objects, key=lambda o: o.get(b'oid')))
615 631
616 with self.ui.makeprogress( 632 with self.ui.makeprogress(