celery5.2.1以下版本任务调用多耗费1秒
问题
5.0.5版本celery存在一个缺陷, 调用任务耗时多用1秒
这个问题在5.2.0, 5.1.2同样存在
没理解为什么到5.2.1版本才解决,甚至一度把celery排除python技术栈
环境描述
python3.6 celery5.0.5 windows 32位
调用celery任务代码摘要
# 1.send_task返回AsyncResult # 2.AsyncResult的get()等待返回结果 # 3.get()会比真实多耗费1秒,并且每次请求都会出现 from celery import Celery class xxxCelery(Celery): def call_xxx(self, name, timeout=120, **kwargs): LOG.info("send_task: %s" % locals()) start = time.time() r = self.send_task(name, **kwargs) g = eventlet.spawn(r.get, timeout=timeout) result = g.wait() print("cost: %s" % time.time()-start) return
两个版本比对
分析celery源码之后,可以知道问题在drain_events()内部, 比较5.2.0和5.2.1版本
#celery/backends/asynchronuse.py class greenletDrainer(Drainer): ... def run(self): self._started.set() while not self._stopped.is_set(): try: self.result_consumer.drain_events(timeout=1) # 新增了两句, 估摸着是这个问题 self._send_drain_complete_event() self._create_drain_complete_event() except socket.timeout: pass self._shutdown.set()
解决办法
celery升级到5.2.1
python要升级到3.7以上版本(celery要求python3.7以上版本)
解决效果
耗时从1000多ms变成了30ms
2023年6月26日 23:07
Vitel Global India has come up with such inventive thought before the outbreak of the pandemic itself and started providing VoIP business phone services to many industries without being compromised in the installation or the customer support.
2023年6月28日 15:52
A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post.
2023年7月10日 21:42
The blog section on this site is my favorite. The articles are well-written and cover a wide range of interesting topics.<a href="https://dlc.co.ke/"title="Business coaching kenya "> Business coaching kenya</a>
2023年7月13日 20:34
A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post.
2023年7月17日 18:25
Hi, My name is Priya Rao and I am working as Marketing Manager with Dr. C.V. Raman University, Bilaspur. Phone (India) : 07753-253801, 91111-08039, 91111-08040
2023年7月17日 19:55
Whisskers marketing Pvt. Ltd. Is the finest digital marketing company that has an enriching experience of working with all kinds of industries and companies�?? sizes. Whisskers believes in providing high quality and following a strict timeline to deliver the project. At Whisskers each client is treated as unique to provide customised digital marketing services and budget friendly plans.
2023年7月19日 20:21
I have been surprised to read over and again that cooking in cast iron is known to greatly increase our dietary source of iron by leaching small amounts of iron into the food we eat. People who are anemic, or have other iron deficiencies, may benefit from this effect, though those with excess iron issues (i.e., people with hemochromatosis) may suffer negative effects.
2023年7月23日 06:05
Hi everyone, I really love your story. You have very useful information; I am from Imamia Quran Academy. Online ahle tashi Madrasa has enabled students to grasp and learn Quran knowledge via one click. It includes the basic beliefs of the Shias, the history of Islam, Nahj al-Balagha (which contains the sermons of Hazrat Ali a.s), and the prayers of other imams such as the book of supplications of Hazrat Imam Sajjad a.s, (Sahifa Sajjadiya).
2023年7月26日 13:42
I am curious to find out what blog system you’re working with? I’m experiencing some minor security problems with my latest blog and I’d like to find something more safe. Do you have any suggestions? warung168
2023年8月07日 19:42
<a href="https://www.centurysteelkuwait.com/"> CenturySteel</a>
2023年8月10日 22:54
i love to also get some beach body but it requires a lot of diet modification and exercise, Ice Cream Cakes in Sanjose
2023年8月15日 20:33
lucky me i see ghost hoodie As the weather gets cooler, finding a stylish and cozy hoodie is a must. And this one takes it a step further with its ghostly charm. It's the perfect balance between spooky and chic – a true wardrobe essential for the upcoming season.
2023年8月18日 21:44 Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. NEVADA FAKE ID
2023年8月18日 21:50
This particular papers fabulous, and My spouse and i enjoy each of the perform that you have placed into this. I’m sure that you will be making a really useful place. I has been additionally pleased. Good perform! sunwin07
2023年8月24日 03:33
Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!Thanks bunimanten.com
2023年8月25日 03:45
You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. 123 movies
2023年8月27日 15:00
This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea. seo gak guna
2023年8月27日 15:14 It’s very informative and you are obviously very knowledgeable in this area. You have opened my eyes to varying views on this topic with interesting and solid content. DMT for sale
2023年8月29日 13:16
I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. boost.web.id
2023年8月29日 14:32
First You got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks. Avaliador Premiado
2023年8月29日 22:36 Thank you for the post. I will definitely comeback. GSA SER List
2023年8月31日 17:00
Thanks for sharing this quality information with us. I really enjoyed reading. Will surely going to share this URL with my friends. last minute naar playa paraiso
2023年9月02日 19:19
Likewise Cannabis is an Oklahoma medical and recreational cannabis dispensary with locations in OKC cannabis dispensary, Edmond cannabis dispensary and Stillwater recreational cannabis dispensary locations. We specialize in offering the best deals on rosin, resin, concentrates, cartridges, edibles, flower, tinctures, topicals, pills and more. If you're looking for the best recreational cannabis dispensary near me with the best prices and deals, drop by today!
2023年9月06日 05:30
Snel, veilig en betrouwbaar research chemicals kopen kunt u
hier doen bij Researchchempro! Het Veilige Alternatief
om Onderzoekschemicaliën te Kopen U Gaat Research Chemicals Kopen.
https://warychems.com/product/methylfenidaat-poeder/
https://warychems.com/product/mephedrone/
https://warychems.com/product/alprazolam-1mg/
https://warychems.com/product/alprazolam-poeder/
https://warychems.com/product/2-fdck/
https://warychems.com/product/ketamine-poeder/
https://warychems.com/product/modafinil-poeder/
Research Chemicals kopen Nederland is marktleider op het gebied van RC’s.
Bij ons vind je de beste kwaliteit,
Discreet verpakte Research Chemicals van Nederland! CATHINONEN,
LIQUIDS, PELLETS, BLOTTERS, DCK, 2F-DCK,
METHALLYLESCALINE, 4FMA, 6APB, 4FMPH, 1P-LSD, 2FMA
https://warychems.com/product/1b-lsd-blotters/
https://warychems.com/product/1p-lsd-pellets/
https://warychems.com/product/2-fa/
https://warychems.com/product/2c-b-pellets-2/
https://warychems.com/product/3-mmc-kristal/
https://warychems.com/product/a-pvp/
https://warychems.com/product/bromazolam-poeder/
https://warychems.com/product/diclazepam-poeder/
https://warychems.com/product/eth-lad-poeder/
https://warychems.com/product/ethylone/
https://warychems.com/product/etizolam-3mg/
https://warychems.com/product/ghb-poeder/
https://warychems.com/product/jwh-018/
https://warychems.com/product/mdma-kristal/
https://warychems.com/product/mdma-pillen-100mg/
https://warychems.com/product/mephedrone/
https://warychems.com/product/methylone/
https://warychems.com/product/synthacaine/
buy chems online
buy research chems
research chemicals kopen
research chemicals credit cards
research chemicals online
buy research chemicals online netherlands
Research Chemicals kopen
2023年9月06日 05:31
Kaufen Sie Marihuana Online mit Cannabis Online Dispensary.
Kaufen Sie Weed Online mit Tracking,
Eßwaren, Konzentrate, Sativa's, Indica's & Hybriden.
Dispensary Versand weltweit
https://caliweedpacks.com/
Cannabis online kaufen
Cannabis-Online-Shop
Weed Lieferung
Marihuana online einkaufen
Marihuana Shop online
Marihuana online
thc shop online
2023年9月09日 14:35
Yuk, teman-teman, buruan kunjungi situs slot gacor WLA ini! Saya baru saja meraih kemenangan besar di sini dan saya tak sabar untuk berbagi keseruan ini dengan Anda semua. Tidak perlu khawatir tentang keamanan, karena situs ini sangat terpercaya. Temukan peluang menang menarik dan rasakan sensasi jackpot yang tak terlupakan! Segera coba keberuntungan Anda, dan siapa tahu, Anda bisa menjadi pemenang berikutnya! SLot Gacor
2023年9月13日 15:11
If you are looking for more information about flat rate locksmith Las Vegas check that right away. boxingstreamsr8
2023年9月14日 05:56
https://stonersmeds.com/nl/shop/buy-3-fmc-powder-research-chemical-online/
https://stonersmeds.com/nl/shop/buy-moroccan-caramello-hash/
https://stonersmeds.com/nl/winkel/koop-lsd-100mcg-blotters-online/
https://stonersmeds.com/nl/shop/4-cmc-kristalpoeder-online-goedkoop-kopen/
https://stonersmeds.com/pl/
https://stonersmeds.com/nl/winkel/koop-crack-cocaine-online/
https://stonersmeds.com/nl/shop/koop-crack-cocaine-online/
https://stonersmeds.com/nl/winkel/koop-k2-papier-online/
https://stonersmeds.com/nl/winkel/buy-moroccan-caramello-hash/
https://stonersmeds.com/nl/shop/koop-honing-marokkaans-blond-hash/
https://stonersmeds.com/nl/shop/buy-peruvian-cocaine-92-pure/
https://stonersmeds.com/de/shop/kaufen-echte-qualitat-tesla-ecstasy-pillen-online/
https://stonersmeds.com/nl/winkel/koop-echte-kwaliteit-tesla-ecstasy-pillen-online/
https://stonersmeds.com/nl/shop/buy-nepalese-stick-hash/
https://stonersmeds.com/de/shop/u-47700-pulver-1-oz-groshandel-online-kaufen/
https://stonersmeds.com/nl/product-categorie/breken/
https://stonersmeds.com/nl/shop/koop-hi-tech-hoest-siroop-online/
https://stonersmeds.com/de/shop/buy-4mmc-mephedrone-online/
https://stonersmeds.com/pl/shop/kup-actavis-prometazyna-syrop-na-kaszel-16-uncji/
https://stonersmeds.com/shop/3-fma/
https://stonersmeds.com/pl/kategoria-produktu/psychodeliki/
https://stonersmeds.com/nl/shop/koop-alpha-pvp-online/
https://stonersmeds.com/fr/shop/
https://stonersmeds.com/pl/sklep/kup-actavis-prometazyna-syrop-na-kaszel-16-uncji/
https://stonersmeds.com/es/categoria-producto/k2-papel-y-spray/
https://stonersmeds.com/nl/winkel/thca-kristallen-bovenste-plank-kopen/
https://stonersmeds.com/de/shop/kaufen-actavis-promethazin-hustensirup-16oz/
https://stonersmeds.com/de/shop/kaufen-crack-kokain-online/
https://stonersmeds.com/da/shop/kob-brun-heroin-99-ren-online/
cocaine te koop
comprar lsd online
research chemical kaufen
ψυχεδελικα μανιταρια αγορα
actavis promethazin
oxykodon prodej
μαγικα μανιταρια κιτ
mdma online kopen
lsd gdzie kupić
2023年9月19日 19:30
In the last several years, the demand for construction equipment auctions has grown enormously. It is one of the attractive places from where to buy equipments at reasonable prices. Construction equipment auctions are a fast and profitable method to liquidate construction equipments. Both new and used construction equipments are sold at these auctions with terms and conditions varying as per market conditions. cmd77
2023年9月23日 14:09
I appreciate your insights. Keep up the good work.I'm sharing this with my friends. Everyone should read this roof repairs dublin.
2023年9月25日 19:59
cheers, I thoroughly enjoyed scaning your post. I really appreciate your wonderful know-how and the time you put into educating the rest of us. Tautan Balik SEO Perjudian dan Kasino