Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

recursive-lambda

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recursive-lambda

allows to create recursive AWS lambda services

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

recursive-lambda

Version npm GitHub stars GitHub license

recursive-lambda is a wrapper around recursive code called within AWS Lambda. It solves the problem of running out of execution time. Should a lambda hit the time limit, it will invoke new lambda so it could carry on with its business.

Example

import Promise from 'bluebird';
import { SimpleStatefulRecursiveService } from 'recursive-lambda';

class ExampleRecursiveService extends SimpleStatefulRecursiveService {

  constructor(params, lambdaClient, context) {
    super(params, lambdaClient, context);
    this.initState({executionCount: 0});
  }

  /*
  Specify logic that will be called recursively until termination logic is met.
  Ex: load DynamoDB records in batches, publish over SNS and repeat until done.
  */
  action(params = {}) {
    return this.exampleEnigmaticRecursiveFunction(params);
  }

  /*
  Specify when you want recursion to stop.
  If you don't overwrite parent implementation,
  your recursive function will be called exactly once
  */
  get executionInvariant() {
    return this.state.executionCount < 4;
  }

  /*
  Specify execution threshold in milliseconds
  */
  get executionThreshold() {
    return 200000;
  }

  exampleEnigmaticRecursiveFunction(params = {}) {
    return new Promise((resolve, reject) => {
      const executionCount = this.state.executionCount + 1;
      this.updateState({executionCount, result: 'accumulated dummy result'});
      resolve();
    });
  }
}

Contributing

Contributions are always welcome!

Developed by [microapps] (http://microapps.com/?utm_source=recursive-lambda-repo-readme&utm_medium=click&utm_campaign=github) Used in our live products: [MoonMail] (https://moonmail.io/?utm_source=recursive-lambda-repo-readme&utm_medium=click&utm_campaign=github) & [MONEI] (https://monei.net/?utm_source=recursive-lambda-repo-readme&utm_medium=click&utm_campaign=github)

License

recursive-lambda is available under the MIT license. See the LICENSE file for more info.

Keywords

FAQs

Package last updated on 25 Aug 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc