Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
此 PR 解决了
OcrManager类中m_task_id属性作为类属性定义的潜在问题。问题:
m_task_id被定义为类属性,这意味着所有OcrManager实例将共享同一个Queue对象。这可能导致在创建多个OcrManager实例时出现意外行为或竞争条件。解决方案: 将
m_task_id属性从类属性更改为实例属性,确保每个OcrManager实例都有其自己的独立任务队列。更改的文件:
wechat_ocr/ocr_manager.py具体更改: 将
m_task_id = Queue(OCR_MAX_TASK_ID)从类定义中移动到__init__方法中,并将其更改为self.m_task_id = Queue(OCR_MAX_TASK_ID)。、