fix(db): fix connection limitation
This commit is contained in:
parent
070119c352
commit
db7217ff0d
@ -27,7 +27,7 @@ let config = {
|
||||
sphinx: {
|
||||
host : '127.0.0.1',
|
||||
port : 9306,
|
||||
connectionLimit: 30
|
||||
connectionLimit: 12
|
||||
},
|
||||
|
||||
spider: {
|
||||
|
@ -2,6 +2,7 @@ import { expect } from "chai";
|
||||
|
||||
const mysql = require('mysql')
|
||||
const config = require('../src/background/config')
|
||||
const {pool} = require('../src/background/mysql')
|
||||
|
||||
describe("sphinx", () => {
|
||||
let sphinx;
|
||||
@ -58,4 +59,16 @@ describe("sphinx", () => {
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it("query limit", function(done) {
|
||||
const sphinx = pool()
|
||||
let promises = []
|
||||
sphinx.query(`delete from feed where id >= 0`, () => {
|
||||
for(let i = 0; i < 500; i++)
|
||||
promises.push(sphinx.query(`insert into feed(id, data) values(${i}, 'a')`))
|
||||
Promise.all(promises).then(() => {
|
||||
sphinx.query(`delete from feed where id >= 0`, () => done())
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user