Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image message bug #160

Merged
merged 4 commits into from
Mar 6, 2020
Merged

Fix image message bug #160

merged 4 commits into from
Mar 6, 2020

Conversation

nonumpa
Copy link
Member

@nonumpa nonumpa commented Mar 4, 2020

  1. Fix image message bug, should only handle text.length >= 3
    Note : text.length < 3 won't be consider as new article sent in.

  2. Limit the number of image messages linebot can process simultaneously.
    Too many image messages process simultaneously will easily cause messages timeout.

@nonumpa nonumpa requested a review from MrOrz March 4, 2020 13:01
@coveralls
Copy link

coveralls commented Mar 4, 2020

Pull Request Test Coverage Report for Build 641

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.25%

Totals Coverage Status
Change from base Build 631: 0.0%
Covered Lines: 219
Relevant Lines: 225

💛 - Coveralls

Copy link
Member

@MrOrz MrOrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the fix!

Let's make the management of imageProcessingCount flag more robust :D

src/index.js Outdated
userId,
req
);
imageProcessingCount--;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anything between imageProcessingCount++ and imageProcessingCount-- throws exception, imageProcessingCount-- will never be executed.

I suggest we do this to make sure imageProcessingCount-- is always called:

imageProcessingCount++;
try {
  // Anything between ++ and --
} finally {
  imageProcessingCount--;
}  

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks for suggestion!!

Copy link
Member

@MrOrz MrOrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MrOrz MrOrz merged commit f44db7a into dev Mar 6, 2020
@MrOrz MrOrz deleted the issue/image-message-bug branch March 6, 2020 03:49
@MrOrz
Copy link
Member

MrOrz commented Mar 7, 2020

It is working great on staging.

The concurrent number 3 is pretty good; when I pass 3 images to staging chatbot, I receive memory quota exceeded error, but since it's not "memory quota vastly exceed" that triggers restart, the 3 images do process in time. I believe we cannot raise the number anymore or we will use up all memory.

@nonumpa nonumpa mentioned this pull request Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants