Changeset 6d8e1e9 in rattail
- Timestamp:
- 07/26/2022 02:24:59 PM (6 months ago)
- Branches:
- master
- Children:
- 5685603
- Parents:
- 9820a0f
- git-author:
- Lance Edgar <lance@…> (07/26/2022 02:19:04 PM)
- git-committer:
- Lance Edgar <lance@…> (07/26/2022 02:24:59 PM)
- Location:
- rattail
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
rattail/app.py
r9820a0f r6d8e1e9 832 832 from rattail.db import Session 833 833 834 # always try to set default continuum user if possible 834 session = Session(**kwargs) 835 836 # try to set continuum user unless kwargs already set it 835 837 if 'continuum_user' not in kwargs: 836 838 if not user: 837 user = self.config.get('rattail', 'runas.default') 839 user = self.config.get('rattail', 'runas.default', 840 session=session) 838 841 if user: 839 kwargs['continuum_user'] = user840 841 return Session(**kwargs)842 session.set_continuum_user(user) 843 844 return session 842 845 843 846 def cache_model(self, session, model, **kwargs): -
rattail/config.py
r9820a0f r6d8e1e9 411 411 """ 412 412 if not hasattr(self, 'app'): 413 spec = self.get('rattail', 'app.handler', 413 spec = self.get('rattail', 'app.handler', usedb=False, 414 414 default='rattail.app:AppHandler') 415 415 factory = load_object(spec) … … 580 580 return url.rstrip('/') 581 581 582 def datasync_url(self ):582 def datasync_url(self, **kwargs): 583 583 """ 584 584 Returns configured URL for managing datasync daemon. 585 585 """ 586 return self.get('rattail.datasync', 'url' )586 return self.get('rattail.datasync', 'url', **kwargs) 587 587 588 588 def get_enum(self, **kwargs): -
rattail/datasync/daemon.py
r9820a0f r6d8e1e9 564 564 # amounts of changes land in the queue with same timestamp, and versioning 565 565 # is also enabled. 566 batch_size = config.getint('rattail.datasync', 'batch_size_limit') 566 batch_size = config.getint('rattail.datasync', 'batch_size_limit', 567 session=session) 567 568 if batch_size and len(changes) > batch_size: 568 569 changes = changes[:batch_size] … … 594 595 'attempts': attempts, 595 596 'traceback': ''.join(format_exception(exc_type, exc, traceback)).strip(), 596 'datasync_url': config.datasync_url( ),597 'datasync_url': config.datasync_url(session=session), 597 598 }) 598 599 return False … … 649 650 'attempts': attempts, 650 651 'traceback': ''.join(format_exception(exc_type, exc, traceback)).strip(), 651 'datasync_url': config.datasync_url( ),652 'datasync_url': config.datasync_url(session=session), 652 653 }) 653 654 return False -
rattail/datasync/rattail.py
r9820a0f r6d8e1e9 61 61 changes = session.query(model.Change).all() 62 62 session.expunge_all() 63 # nb. fetch config flag while we have session open 64 deleted_first = self.config.getbool( 65 'rattail.datasync', 'rattail_watcher_deleted_first', 66 session=session, 67 default=False) 63 68 session.close() 64 69 if not changes: … … 86 91 # so that deletes are processed last, by the consumer(s), to 87 92 # hopefully avoid dependency issues 88 deleted_first = self.config.getbool(89 'rattail.datasync', 'rattail_watcher_deleted_first',90 default=False)91 93 if deleted_first: 92 94 final = deleted + dirty … … 184 186 self.topo_sortkey = make_topo_sortkey(self.model) 185 187 188 # TODO: deprecate / remove this 186 189 def get_data_model(self): 187 190 """ … … 189 192 Defaults to ``rattail.db.model``. 190 193 """ 191 return model194 return self.config.get_model() 192 195 193 196 def process_changes(self, host_session, changes):
Note: See TracChangeset
for help on using the changeset viewer.