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

connection-lifeguard

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connection-lifeguard

ConnectionLifeguard MicroService on Lambda

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ConnectionLifeguard Service

Overview

ConnectionLifegaurd is used to determine when a client is allowed to obtain a connection with a database.

See also ABOUT

Example Usage
const { axios } = require('@nuskin/axios-util')
const baseUrl = 'https://devapi.cloud.nuskin.com/connection-lifeguard/v1'

const main = async () => {
  const pool = 'lambdaName'
  let uuid
  let approved
  try {
    let count = 0
    do {
      count++
      const response = await axios.get(`${baseUrl}/${pool}`)
      approved = response.data.approved
      if(approved){
        uuid = response.data.uuid
        // you're allowed to get a db connection now.
        // do your processing here onse.data.uuid
      }
    } while(!approved && count<4) // attempt to get approval 4 times
  } catch(error) {
      console.error("We got an error: ",error)
  } finally {
    // Close your connection with the database here.
    // Tell the connection lifeguard you are done and don't 
    // need your connection anymore
    await axios.delete(`${baseUrl}/${pool}/${uuid}`)
  }
}

main()
Example Response
{
  "approved": true,
  "count": 7,
  "uuid": "N3ZCSMAUs2DGs1PA2ItxxX"
}

Resources

License

MIT

FAQs

Package last updated on 06 Oct 2021

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