• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python queue.maybe_delay函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sentry.utils.queue.maybe_delay函数的典型用法代码示例。如果您正苦于以下问题:Python maybe_delay函数的具体用法?Python maybe_delay怎么用?Python maybe_delay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了maybe_delay函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: check_alerts

def check_alerts(**kwargs):
    """
    Iterates all current keys and fires additional tasks to check each individual
    project's alert settings.
    """
    from sentry.models import ProjectCountByMinute
    from sentry.utils.queue import maybe_delay

    now = timezone.now()
    # we want at least a 60 second window of events
    max_date = now - timedelta(minutes=1)
    min_date = max_date - timedelta(minutes=MINUTE_NORMALIZATION)

    # find each project which has data for the last interval
    # TODO: we could force more work on the db by eliminating onces which don't have the full aggregate we need
    qs = ProjectCountByMinute.objects.filter(
        date__lte=max_date,
        date__gt=min_date,
        times_seen__gt=0,
    ).values_list('project_id', 'date', 'times_seen')
    for project_id, date, count in qs:
        normalized_count = int(count / ((now - date).seconds / 60))
        maybe_delay(check_project_alerts,
            project_id=project_id,
            when=max_date,
            count=normalized_count,
            expires=120,
        )
开发者ID:lxyu,项目名称:sentry,代码行数:28,代码来源:check_alerts.py


示例2: post_process_group

def post_process_group(group, **kwargs):
    """
    Fires post processing hooks for a group.
    """
    for plugin in plugins.all():
        if safe_execute(plugin.is_enabled, group.project):
            maybe_delay(
                plugin_post_process_group, plugin.slug, group=group, **kwargs)
开发者ID:ramirors,项目名称:sentry,代码行数:8,代码来源:post_process.py


示例3: maybe_delay

        for view in views:
            group.views.add(view)

        # save the event unless its been sampled
        if not is_sample:
            try:
                event.save()
            except IntegrityError:
                transaction.rollback_unless_managed(using=group._state.db)
                return event

        transaction.commit_unless_managed(using=group._state.db)

        if settings.USE_SEARCH:
            try:
                maybe_delay(index_event, event)
            except Exception, e:
                transaction.rollback_unless_managed(using=group._state.db)
                logger.exception(u'Error indexing document: %s', e)

        if is_new:
            try:
                regression_signal.send(sender=self.model, instance=group)
            except Exception, e:
                transaction.rollback_unless_managed(using=group._state.db)
                logger.exception(u'Error sending regression signal: %s', e)

        send_group_processors(group=group, event=event, is_new=is_new, is_sample=is_sample)

        return event
开发者ID:Erkan-Yilmaz,项目名称:sentry,代码行数:30,代码来源:manager.py


示例4: insert_data_to_database

def insert_data_to_database(data):
    maybe_delay(store_event, data=data)
开发者ID:Supy,项目名称:sentry,代码行数:2,代码来源:coreapi.py


示例5: maybe_delay

        event.group = group

        # save the event unless its been sampled
        if not is_sample:
            try:
                event.save()
            except IntegrityError:
                transaction.rollback_unless_managed(using=group._state.db)
                return event

        transaction.commit_unless_managed(using=group._state.db)

        if settings.USE_SEARCH:
            try:
                maybe_delay(index_event, event)
            except Exception, e:
                transaction.rollback_unless_managed(using=group._state.db)
                logger.exception(u'Error indexing document: %s', e)

        if settings.SCRAPE_JAVASCRIPT_CONTEXT and event.platform == 'javascript' and not is_sample:
            try:
                maybe_delay(fetch_javascript_source, event)
            except Exception, e:
                transaction.rollback_unless_managed(using=group._state.db)
                logger.exception(u'Error fetching javascript source: %s', e)

        if is_new:
            try:
                regression_signal.send_robust(sender=self.model, instance=group)
            except Exception, e:
开发者ID:lukegb,项目名称:sentry,代码行数:30,代码来源:manager.py


示例6: send_group_processors

def send_group_processors(group, **kwargs):
    maybe_delay(post_process_group, group=group, **kwargs)
开发者ID:DamianZaremba,项目名称:sentry,代码行数:2,代码来源:base.py


示例7: incr

 def incr(self, model, columns, filters, extra=None):
     """
     >>> incr(Group, columns={'times_seen': 1}, filters={'pk': group.pk})
     """
     maybe_delay(process_incr, model=model, columns=columns, filters=filters, extra=extra)
开发者ID:clvrobj,项目名称:sentry,代码行数:5,代码来源:base.py



注:本文中的sentry.utils.queue.maybe_delay函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python clusters.get函数代码示例发布时间:2022-05-27
下一篇:
Python query.bulk_delete_objects函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap