Changeset 173 in tracdarcs for tracdarcs/components.py


Ignore:
Timestamp:
05/08/10 21:28:22 (2 years ago)
Author:
lele@…
Hash name:
20100508192822-97f81-b1bb7bbbea66114acc0c79d962bd856ff264cf23
Message:

Optional constraint on the number of concurrent darcs processes
A new option "darcs.max_concurrent_darcses" may set a limit on the
number of concurrent running darcs subprocesses. It is eventually
applied on a per repository basis. By default there are no limits, as
before.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tracdarcs/components.py

    r170 r173  
    3737    darcs_command = Option('darcs', 'command', 'darcs', 
    3838                           "Name of the external darcs binary.") 
     39 
     40    max_concurrent_darcses = Option('darcs', 'max_concurrent_darcses', 'false', 
     41                                    "Max number of concurrent darcses running per repository.") 
    3942 
    4043    possible_encodings = Option('darcs', 'possible_encodings', 'utf-8,iso8859-1', 
     
    5659            possible_encodings = [e.strip() 
    5760                                  for e in self.possible_encodings.split(',')] 
     61 
     62        # Setup the semaphore used to limit the number of concurrent running 
     63        # darcs within a single repository. 
     64 
     65        if self.max_concurrent_darcses and int(self.max_concurrent_darcses)>0: 
     66            from command import DarcsCommand 
     67            if DarcsCommand.RUNNING_DARCSES is None: 
     68                from threading import BoundedSemaphore 
     69                DarcsCommand.RUNNING_DARCSES = BoundedSemaphore(value=int(self.max_concurrent_darcses)) 
     70 
    5871        return DarcsRepository(db, dir, self.env.log, darcs, possible_encodings, params) 
    5972 
Note: See TracChangeset for help on using the changeset viewer.