yap
This commit is contained in:
parent
e7d6e60d97
commit
48c79003c6
7 changed files with 64 additions and 60 deletions
|
@ -6,7 +6,6 @@ from app import app, notification_queue
|
|||
from data import model
|
||||
from auth.auth_context import get_authenticated_user, get_validated_oauth_token
|
||||
|
||||
|
||||
DEFAULT_BATCH_SIZE = 1000
|
||||
|
||||
|
||||
|
@ -17,8 +16,7 @@ def build_repository_event_data(namespace_name, repo_name, extra_data=None, subp
|
|||
"""
|
||||
repo_string = '%s/%s' % (namespace_name, repo_name)
|
||||
homepage = '%s://%s/repository/%s' % (app.config['PREFERRED_URL_SCHEME'],
|
||||
app.config['SERVER_HOSTNAME'],
|
||||
repo_string)
|
||||
app.config['SERVER_HOSTNAME'], repo_string)
|
||||
|
||||
if subpage:
|
||||
if not subpage.startswith('/'):
|
||||
|
@ -37,6 +35,7 @@ def build_repository_event_data(namespace_name, repo_name, extra_data=None, subp
|
|||
event_data.update(extra_data or {})
|
||||
return event_data
|
||||
|
||||
|
||||
def build_notification_data(notification, event_data, performer_data=None):
|
||||
if not performer_data:
|
||||
performer_data = {}
|
||||
|
@ -67,13 +66,13 @@ def notification_batch(batch_size=DEFAULT_BATCH_SIZE):
|
|||
the callable will be bulk inserted into the queue with the specified batch size.
|
||||
"""
|
||||
with notification_queue.batch_insert(batch_size) as queue_put:
|
||||
|
||||
def spawn_notification_batch(repo, event_name, extra_data=None, subpage=None, pathargs=None,
|
||||
performer_data=None):
|
||||
event_data = build_repository_event_data(repo.namespace_name, repo.name,
|
||||
extra_data=extra_data, subpage=subpage)
|
||||
|
||||
notifications = model.notification.list_repo_notifications(repo.namespace_name,
|
||||
repo.name,
|
||||
notifications = model.notification.list_repo_notifications(repo.namespace_name, repo.name,
|
||||
event_name=event_name)
|
||||
path = [repo.namespace_name, repo.name, event_name] + (pathargs or [])
|
||||
for notification in list(notifications):
|
||||
|
|
Reference in a new issue