🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

lambda-continue

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-continue

Chaining lambda calls

1.1.1
latest
Source
npm
Version published
Weekly downloads
21
2000%
Maintainers
1
Weekly downloads
 
Created
Source

lambda-continue

Chaining lambda call to beat 15minutes execution

Installation

npm i --save lambda-continue

Usage

import { createHandler } from 'lambda-continue'

// Your lambda Handler
export const handler = (event, context) => {
  const payload_a = event.body?.payload_a
  const h = createHandler((offset, continueContext) => {
    // do your stuff continue from given offset.
    for(const i = offset; i < 100000000; i++) {
      // Halt if needed.
      if (continueContext.shouldStop()) {
        return i
      }

      await continueContext.assertCancellation(offset)

      // do long running process here!
    }
  }, {
    cycleMinutes: 12,           // execute at maximum 12 minutes per cycle
    cycleAllowed: 3,            // execute at maximum 3 times
    lambdaFunctionName: 'Your-Lambda-Function-Name!',
    extraPayload: {
      payload_a: payload_a,    // Keep passing the original payloads to make sure our next execution keep going with the correct parameters.
    },
    lambda: new AWS.Lambda(),   // customize your Lambda here!
  }))

  return h(event, context)
}

Keywords

lambda

FAQs

Package last updated on 22 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts