add tags for sentry
This commit is contained in:
		@@ -28,29 +28,24 @@ def execute_feed(feed_pk):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    config._reload_maybe()
 | 
					    config._reload_maybe()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    feed = None
 | 
					    feed = Feed.objects.get(pk=feed_pk)
 | 
				
			||||||
    try:
 | 
					 | 
				
			||||||
        feed = Feed.objects.get(pk=feed_pk)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # if not feed.lock:
 | 
					    with sentry_sdk.configure_scope() as scope:
 | 
				
			||||||
        #     feed.lock = True
 | 
					        scope.set_extra('feed', str(feed))
 | 
				
			||||||
        #     feed.save()
 | 
					        try:
 | 
				
			||||||
        # else:
 | 
					            bot = TeleBot(config.feed_bot_token, threaded=False)
 | 
				
			||||||
        #     raise Reject('Lock', requeue=False)
 | 
					            print(f'Last ID for "{feed}" = "{feed.last_id}"')
 | 
				
			||||||
 | 
					            for last_id in feed.config.execute(bot, feed.chat_id, feed.last_id):
 | 
				
			||||||
        bot = TeleBot(config.feed_bot_token, threaded=False)
 | 
					                if last_id:
 | 
				
			||||||
        print(f'Last ID for "{feed}" = "{feed.last_id}"')
 | 
					                    feed.last_id = last_id
 | 
				
			||||||
        for last_id in feed.config.execute(bot, feed.chat_id, feed.last_id):
 | 
					                    feed.save()
 | 
				
			||||||
            if last_id:
 | 
					                    print(f'Saved last ID for "{feed}" = "{feed.last_id}"')
 | 
				
			||||||
                feed.last_id = last_id
 | 
					            feed.last_check = timezone.now()
 | 
				
			||||||
                feed.save()
 | 
					 | 
				
			||||||
                print(f'Saved last ID for "{feed}" = "{feed.last_id}"')
 | 
					 | 
				
			||||||
        feed.last_check = timezone.now()
 | 
					 | 
				
			||||||
        feed.save()
 | 
					 | 
				
			||||||
    except Exception as e:
 | 
					 | 
				
			||||||
        sentry_sdk.capture_exception(e)
 | 
					 | 
				
			||||||
        traceback.print_exc()
 | 
					 | 
				
			||||||
    finally:
 | 
					 | 
				
			||||||
        if feed:
 | 
					 | 
				
			||||||
            feed.lock = False
 | 
					 | 
				
			||||||
            feed.save()
 | 
					            feed.save()
 | 
				
			||||||
 | 
					        except Exception as e:
 | 
				
			||||||
 | 
					            sentry_sdk.capture_exception(e)
 | 
				
			||||||
 | 
					            traceback.print_exc()
 | 
				
			||||||
 | 
					        finally:
 | 
				
			||||||
 | 
					            if feed:
 | 
				
			||||||
 | 
					                feed.lock = False
 | 
				
			||||||
 | 
					                feed.save()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user