Skip to content

Closing the stream #30

Description

@richburdon

This may relate to my inexperience with streams, but I would expect the my simple test app to terminate after consuming the "finish" stream event? I know I can call process.exit, but the fact that it doesn't exit concerns me that some resource (request socket?) is being left open (and could accumulate/leak on subsequent calls?)

let gmail = new Gmail(ACCESS_TOKEN);
let stream = gmail.messages('label:inbox', { max: 10, fields: ['id', 'labelIds', 'snippet'] });
stream.on('data', (message) => {
  console.log(JSON.stringify(data));
});
stream.on('finish', () => {
  console.error('## PROCESS STAYS RUNNING ##');
});

I see the retrieve method calls combined.end() so I can't figure out why the process doesn't exit after the stream is closed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions