Skip to content
Permalink
Browse files

Merge pull request #13 from jeremydaly/v1.2.0

v1.2.0
  • Loading branch information...
jeremydaly committed Dec 7, 2018
2 parents 3dcbb86 + 27940bd commit 3659f6c41952635ad4873d47cc7c045f620918a2
Showing with 320 additions and 207 deletions.
  1. +3 −0 README.md
  2. +4 −1 index.js
  3. +307 −200 package-lock.json
  4. +6 −6 package.json
@@ -1,5 +1,8 @@
# Serverless MySQL

[![npm](https://img.shields.io/npm/v/serverless-mysql.svg)](https://www.npmjs.com/package/serverless-mysql)
[![npm](https://img.shields.io/npm/l/serverless-mysql.svg)](https://www.npmjs.com/package/serverless-mysql)

### A module for managing MySQL connections at *serverless* scale.

Serverless MySQL is a wrapper for Doug Wilson's amazing **[mysql](https://github.com/mysqljs/mysql)** Node.js module. Normally, using the `mysql` module with Node apps would be just fine. However, serverless functions (like AWS Lambda, Google Cloud Functions, and Azure Functions) scale almost infinitely by creating separate instances for each concurrent user. This is a **MAJOR PROBLEM** for RDBS solutions like MySQL, because available connections can be quickly maxed out by competing functions. Not anymore. 😀
@@ -187,8 +187,11 @@ const query = async function(...args) {
client.destroy() // destroy connection on timeout
resetClient() // reset the client
reject(err) // reject the promise with the error
} else if (err && /^PROTOCOL_ENQUEUE_AFTER_/.test(err.code)) {
resetClient() // reset the client
return resolve(query(...args)) // attempt the query again
} else if (err) {
if (this.rollback) {
if (this && this.rollback) {
await query('ROLLBACK')
this.rollback(err)
}
Oops, something went wrong.

0 comments on commit 3659f6c

Please sign in to comment.
You can’t perform that action at this time.