mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-25 00:36:00 +00:00
fixed unwanted closing connections
This commit is contained in:
@@ -120,7 +120,7 @@ function start() {
|
|||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const time = new Date().getTime();
|
const time = new Date().getTime();
|
||||||
if (time - lastPing > 60 * 1000) {
|
if (time - lastPing > 120 * 1000) {
|
||||||
console.log('Database connection not alive, exiting');
|
console.log('Database connection not alive, exiting');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ function start() {
|
|||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const time = new Date().getTime();
|
const time = new Date().getTime();
|
||||||
if (time - lastPing > 60 * 1000) {
|
if (time - lastPing > 120 * 1000) {
|
||||||
|
console.log('Server connection not alive, exiting');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
}, 60 * 1000);
|
}, 60 * 1000);
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import axios from './axios';
|
|||||||
export default function ConnectionsPinger({ children }) {
|
export default function ConnectionsPinger({ children }) {
|
||||||
const openedConnections = useOpenedConnections();
|
const openedConnections = useOpenedConnections();
|
||||||
const currentDatabase = useCurrentDatabase();
|
const currentDatabase = useCurrentDatabase();
|
||||||
React.useEffect(() => {
|
|
||||||
const handle = window.setInterval(() => {
|
const doPing = () => {
|
||||||
axios.post('server-connections/ping', { connections: openedConnections });
|
axios.post('server-connections/ping', { connections: openedConnections });
|
||||||
|
|
||||||
const database = _.get(currentDatabase, 'name');
|
const database = _.get(currentDatabase, 'name');
|
||||||
@@ -15,7 +15,11 @@ export default function ConnectionsPinger({ children }) {
|
|||||||
if (conid && database) {
|
if (conid && database) {
|
||||||
axios.post('database-connections/ping', { conid, database });
|
axios.post('database-connections/ping', { conid, database });
|
||||||
}
|
}
|
||||||
}, 30 * 1000);
|
};
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
doPing();
|
||||||
|
const handle = window.setInterval(doPing, 30 * 1000);
|
||||||
return () => window.clearInterval(handle);
|
return () => window.clearInterval(handle);
|
||||||
}, [openedConnections, currentDatabase]);
|
}, [openedConnections, currentDatabase]);
|
||||||
return children;
|
return children;
|
||||||
|
|||||||
Reference in New Issue
Block a user