Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Flush message or wait for queue being fully drained #338

Open
@arabold

Description

@arabold

This is a feature request and a follow-up of #167.

TL;DR: Provide a method Raven.flush() that waits for all messages to drain and the queue being empty.

Background

We're using raven-node in our AWS Lambda environment for quite a while now. It works very well! However, there's one caveat with AWS Lambda - after your code runs it pauses the node thread until the next request comes in. After about 15 minutes of being idle it terminates the process completely. That's all fine as long as you know and work with that.

I'm the author of the Serverless Sentry Plugin which simplifies integration of raven-node with the popular Serverless Framework. Due to the reason above, I like to make sure that all pending messages sent via captureMessage or captureException have been sent before returning and allowing AWS Lambda to fall asleep until the next request. So I need a way of knowing that all pending messages have been forwarded to Sentry.

Proposal

I'm aware of the callback parameter in raven captureMessage and captureException but this wouldn't be very practical for this case. Users still want to send out messages in the background without affecting their main application code chain. I.e. it's not an option to wait until raven has sent out its data (which takes around 300 msec) before continuing with the rest of the code. Instead I

At the end of the day there should be a function like Raven.flush() or similar to wait for all messages having drained. This would be the last call done in the AWS Lambda handler to ensure all errors have been reported before exiting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions