由EventGrid触发的Python Azure函数在成功运行后会继续触发吗? [英] EventGrid-triggered, Python Azure Function keeps triggering after successfully running?

查看:64
本文介绍了由EventGrid触发的Python Azure函数在成功运行后会继续触发吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还有其他几个主题,但没有一个解决方案,也没有一个与Python函数有关的主题.

背景:

  • EventGrid触发的Python Azure函数
  • 当将Blob上传到给定的存储帐户时,
  • 创建了EventGrid消息
  • 函数接收消息,从消息URL下载blob并执行填充"
  • 该功能可以运行几秒钟/分钟(大斑点时最多可以运行120秒)

问题示例:

  • 4个文件以正确的存储帐户上传到blob容器
  • 该函数通过4条独立的EventGrid消息成功触发了4次
  • 函数从每个消息中的URL下载blob,执行填充"
  • 〜55秒后,又有4条EventGrid消息再次触发该函数(对于相同的4个文件!)
  • 一切重复

多次发生,导致4个文件执行12个函数:

  • 以及内容"中相应的输出该功能可以!

将2500个文件上传到存储帐户时,这太荒谬了!

似乎我需要调整EventGrid重试时间.但我在门户网站中看不到此设置:

如何防止这种行为?

然后,今天...上传的16个文件没有问题...为什么EventGrid会不一致地触发此功能?

今天又是……无缘无故,一个小时后……尽管没有更多文件上传到存储帐户,EventGrid触发了更多的触发器./p>

以下是16个正在上传到存储帐户的文件的EventGrid统计信息.

  • 在某些情况下,两次重试之间大约需要1个小时,您可以清楚地看到所有数字.
  • 对我来说很随意

对于任何有兴趣的人...

基于"Microsoft.Storage.BlobCreated event" and one for "Microsoft.Storage.BlobCreated event (Data Lake Storage Gen2)"

  • Because the data.url parameter of the EventGrid message is different (xxx.blob.core.windows.net vs. xxx.dfs.core.windows.net), my Function is failing (as it uses BlobClient.from_blob_url
  • More to come.
  • 解决方案

    Based on the doc, the subscriber (such as your EventGridTrigger function) needs to send a response back to the AEG within the 30 seconds otherwise the message is queued for retry.

    Note, that the event is removed from the retry queue when the AEG received within 3 minutes successful respond from the delivery destination endpoint (subscriber). If the deadlettering feature is on, the event is removed from the retry queue also when the respond failure code are 400 or 413.

    Based on the above and your long running subscriber, the AEG sent a duplicate event within the 3 minutes.

    I do recommend use a Push-Pull pattern in your solution such as delivery an event to the storage queue.

    这篇关于由EventGrid触发的Python Azure函数在成功运行后会继续触发吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆