Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/le0pard/pgtune.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorAlexey Vasiliev <leopard.not.a@gmail.com>2022-10-13 19:28:20 +0300
committerAlexey Vasiliev <leopard.not.a@gmail.com>2022-10-13 19:28:20 +0300
commit41077d501ef36b7c95ccc0483e364ebab82f2230 (patch)
tree0cdeb0c5f86572d34b7d3601d7f28e4dd4bdac1f /assets
parent0654ae1764ab78c08d2148adbf85743bc73baa80 (diff)
released new postgresql
Diffstat (limited to 'assets')
-rw-r--r--assets/app.js8
-rw-r--r--assets/appWrapper.js4
-rw-r--r--assets/components/appUpdate/index.js8
-rw-r--r--assets/components/configurationForm/index.js12
-rw-r--r--assets/components/configurationForm/totalMemoryInput.js4
-rw-r--r--assets/components/configurationView/index.js26
-rw-r--r--assets/components/copyButton/index.js6
-rw-r--r--assets/components/form/tooltip.js2
-rw-r--r--assets/components/githubCorner/index.js8
-rw-r--r--assets/components/mainGenerator/index.js8
-rw-r--r--assets/components/themeSwitcher/index.js10
-rw-r--r--assets/hooks/useIsMounted.js2
-rw-r--r--assets/pages/app.js4
-rw-r--r--assets/reducers/configuration/constants.js4
-rw-r--r--assets/reducers/configuration/index.js4
-rw-r--r--assets/reducers/settings/index.js6
-rw-r--r--assets/reducers/sw.js4
-rw-r--r--assets/redux/rootReducer.js8
-rw-r--r--assets/redux/store.js6
-rw-r--r--assets/root.js6
-rw-r--r--assets/selectors/__tests__/configuration.js42
-rw-r--r--assets/selectors/configuration.js102
-rw-r--r--assets/sw.js12
-rw-r--r--assets/swWindow.js6
24 files changed, 137 insertions, 165 deletions
diff --git a/assets/app.js b/assets/app.js
index 6548f8c..c8e673c 100644
--- a/assets/app.js
+++ b/assets/app.js
@@ -1,11 +1,11 @@
import './init'
import React from 'react'
-import {createRoot} from 'react-dom/client'
+import { createRoot } from 'react-dom/client'
import Root from './root'
-import {APP_THEMES_LIGHT, APP_THEMES_DARK} from 'reducers/settings/constants'
+import { APP_THEMES_LIGHT, APP_THEMES_DARK } from 'reducers/settings/constants'
import LocalStorage from 'lib/localStorage'
-import {initializeStore} from './redux/store'
-import {initServiceWorker} from './swWindow'
+import { initializeStore } from './redux/store'
+import { initServiceWorker } from './swWindow'
// render app
const renderApp = (Component, appRoot, store) => {
initServiceWorker(store)
diff --git a/assets/appWrapper.js b/assets/appWrapper.js
index 7e2451c..15d2b1d 100644
--- a/assets/appWrapper.js
+++ b/assets/appWrapper.js
@@ -1,5 +1,5 @@
-import {routes} from './routes'
-import {useRoutes} from 'react-router-dom'
+import { routes } from './routes'
+import { useRoutes } from 'react-router-dom'
const AppWrapper = () => {
const element = useRoutes(routes)
diff --git a/assets/components/appUpdate/index.js b/assets/components/appUpdate/index.js
index 7971e74..5454a1e 100644
--- a/assets/components/appUpdate/index.js
+++ b/assets/components/appUpdate/index.js
@@ -1,13 +1,13 @@
import React from 'react'
-import {useDispatch, useSelector} from 'react-redux'
-import {updating} from 'reducers/sw'
-import {skipWaitingMessageAndReload} from 'swWindow'
+import { useDispatch, useSelector } from 'react-redux'
+import { updating } from 'reducers/sw'
+import { skipWaitingMessageAndReload } from 'swWindow'
import './app-update.css'
const AppUpdate = () => {
const dispatch = useDispatch()
- const isNewVersionAvailable = useSelector(({sw}) => sw.isNewVersionAvailable)
+ const isNewVersionAvailable = useSelector(({ sw }) => sw.isNewVersionAvailable)
const reloadPage = (e) => {
e.preventDefault()
diff --git a/assets/components/configurationForm/index.js b/assets/components/configurationForm/index.js
index dd0d2d5..49fa7e1 100644
--- a/assets/components/configurationForm/index.js
+++ b/assets/components/configurationForm/index.js
@@ -1,12 +1,12 @@
import React from 'react'
-import {useDispatch} from 'react-redux'
+import { useDispatch } from 'react-redux'
import classnames from 'classnames'
-import {Formik, Field, Form} from 'formik'
+import { Formik, Field, Form } from 'formik'
import FormField from 'components/form/field'
import FormDropdown from 'components/form/dropdown'
import TotalMemoryInput from './totalMemoryInput'
-import {submitConfiguration} from 'reducers/configuration'
-import {validationSchema} from './validation'
+import { submitConfiguration } from 'reducers/configuration'
+import { validationSchema } from './validation'
import {
DEFAULT_DB_VERSION,
DB_VERSIONS,
@@ -95,7 +95,7 @@ const hdTypeOptions = () => (
const ConfigurationForm = () => {
const dispatch = useDispatch()
- const handleGenerateConfig = (values, {setSubmitting}) => {
+ const handleGenerateConfig = (values, { setSubmitting }) => {
dispatch(submitConfiguration(values))
setSubmitting(false)
}
@@ -114,7 +114,7 @@ const ConfigurationForm = () => {
hdType: HARD_DRIVE_SSD
}}
validationSchema={validationSchema}
- >{({isSubmitting}) => (
+ >{({ isSubmitting }) => (
<Form>
<Field
name="dbVersion"
diff --git a/assets/components/configurationForm/totalMemoryInput.js b/assets/components/configurationForm/totalMemoryInput.js
index 4233244..1f5fd88 100644
--- a/assets/components/configurationForm/totalMemoryInput.js
+++ b/assets/components/configurationForm/totalMemoryInput.js
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
-import {Field} from 'formik'
+import { Field } from 'formik'
import Tooltip from 'components/form/tooltip'
import FormSimpleField from 'components/form/simpleField'
import FormSimpleDropdown from 'components/form/simpleDropdown'
@@ -24,7 +24,7 @@ const totalMemoryUnitOptions = () => (
]
)
-const TotalMemoryInput = ({tooltip}) => {
+const TotalMemoryInput = ({ tooltip }) => {
const inputID = 'TotalMemoryId'
return (
diff --git a/assets/components/configurationView/index.js b/assets/components/configurationView/index.js
index 7225dc0..afd5f49 100644
--- a/assets/components/configurationView/index.js
+++ b/assets/components/configurationView/index.js
@@ -1,7 +1,7 @@
import React from 'react'
import classnames from 'classnames'
-import {useDispatch, useSelector} from 'react-redux'
-import {Light as SyntaxHighlighter} from 'react-syntax-highlighter'
+import { useDispatch, useSelector } from 'react-redux'
+import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'
import iniLang from 'react-syntax-highlighter/dist/cjs/languages/hljs/ini'
import sqlLang from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql'
import solarizedLight from 'react-syntax-highlighter/dist/cjs/styles/hljs/solarized-light'
@@ -27,7 +27,7 @@ import {
workMem,
warningInfoMessages
} from 'selectors/configuration'
-import {openConfigTab} from 'reducers/settings'
+import { openConfigTab } from 'reducers/settings'
import './configuration-view.css'
@@ -71,14 +71,14 @@ const ConfigurationView = () => {
const dispatch = useDispatch()
// hardware configuration
- const dbVersion = useSelector(({configuration}) => configuration.dbVersion)
- const osType = useSelector(({configuration}) => configuration.osType)
- const dbType = useSelector(({configuration}) => configuration.dbType)
- const totalMemory = useSelector(({configuration}) => configuration.totalMemory)
- const totalMemoryUnit = useSelector(({configuration}) => configuration.totalMemoryUnit)
- const cpuNum = useSelector(({configuration}) => configuration.cpuNum)
- const connectionNum = useSelector(({configuration}) => configuration.connectionNum)
- const hdType = useSelector(({configuration}) => configuration.hdType)
+ const dbVersion = useSelector(({ configuration }) => configuration.dbVersion)
+ const osType = useSelector(({ configuration }) => configuration.osType)
+ const dbType = useSelector(({ configuration }) => configuration.dbType)
+ const totalMemory = useSelector(({ configuration }) => configuration.totalMemory)
+ const totalMemoryUnit = useSelector(({ configuration }) => configuration.totalMemoryUnit)
+ const cpuNum = useSelector(({ configuration }) => configuration.cpuNum)
+ const connectionNum = useSelector(({ configuration }) => configuration.connectionNum)
+ const hdType = useSelector(({ configuration }) => configuration.hdType)
// computed settings
const maxConnectionsVal = useSelector(maxConnections)
const sharedBuffersVal = useSelector(sharedBuffers)
@@ -95,9 +95,9 @@ const ConfigurationView = () => {
// warnings
const warningInfoMessagesVal = useSelector(warningInfoMessages)
// tab state
- const tabState = useSelector(({settings}) => settings.tabState)
+ const tabState = useSelector(({ settings }) => settings.tabState)
// app theme
- const theme = useSelector(({settings}) => settings.theme)
+ const theme = useSelector(({ settings }) => settings.theme)
// tab click state
const handleClickTab = (tab) => dispatch(openConfigTab(tab))
diff --git a/assets/components/copyButton/index.js b/assets/components/copyButton/index.js
index b5d88b1..6e28977 100644
--- a/assets/components/copyButton/index.js
+++ b/assets/components/copyButton/index.js
@@ -1,11 +1,11 @@
-import React, {useRef, useState, useEffect} from 'react'
+import React, { useRef, useState, useEffect } from 'react'
import PropTypes from 'prop-types'
-import {useIsMounted} from 'hooks/useIsMounted'
+import { useIsMounted } from 'hooks/useIsMounted'
import Clipboard from 'clipboard'
const COPIED_TIMEOUT = 2000
-const CopyButton = ({text, className, label = 'Copy', successLabel = 'Copied', errorLabel = 'Error'}) => {
+const CopyButton = ({ text, className, label = 'Copy', successLabel = 'Copied', errorLabel = 'Error' }) => {
const copyButton = useRef()
const clipboard = useRef()
const mounted = useIsMounted()
diff --git a/assets/components/form/tooltip.js b/assets/components/form/tooltip.js
index b437dce..a0765e5 100644
--- a/assets/components/form/tooltip.js
+++ b/assets/components/form/tooltip.js
@@ -1,4 +1,4 @@
-import React, {useEffect, useRef, useState} from 'react'
+import React, { useEffect, useRef, useState } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
diff --git a/assets/components/githubCorner/index.js b/assets/components/githubCorner/index.js
index 9385961..9488567 100644
--- a/assets/components/githubCorner/index.js
+++ b/assets/components/githubCorner/index.js
@@ -1,11 +1,11 @@
import React from 'react'
-import {useSelector} from 'react-redux'
-import {APP_THEMES_LIGHT, APP_THEMES_DARK} from 'reducers/settings/constants'
+import { useSelector } from 'react-redux'
+import { APP_THEMES_LIGHT, APP_THEMES_DARK } from 'reducers/settings/constants'
import './github-corner.css'
const GithubCorner = () => {
- const theme = useSelector(({settings}) => (
+ const theme = useSelector(({ settings }) => (
APP_THEMES_LIGHT === settings.theme ? APP_THEMES_DARK : APP_THEMES_LIGHT
))
@@ -43,7 +43,7 @@ const GithubCorner = () => {
<a href="https://github.com/le0pard/pgtune" className="github-corner" aria-label="View source on Github">
<svg width="80" height="80" viewBox="0 0 250 250" style={svgStyles()} aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z" />
- <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style={{transformOrigin: '130px 106px'}} className="github-corner-arm" />
+ <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style={{ transformOrigin: '130px 106px' }} className="github-corner-arm" />
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" className="github-corner-body" />
</svg>
</a>
diff --git a/assets/components/mainGenerator/index.js b/assets/components/mainGenerator/index.js
index aea8cb9..b16f2d0 100644
--- a/assets/components/mainGenerator/index.js
+++ b/assets/components/mainGenerator/index.js
@@ -1,7 +1,7 @@
-import React, {useEffect} from 'react'
-import {useDispatch, useSelector} from 'react-redux'
-import {isReadyForConfiguration} from 'selectors/configuration'
-import {resetConfiguration} from 'reducers/configuration'
+import React, { useEffect } from 'react'
+import { useDispatch, useSelector } from 'react-redux'
+import { isReadyForConfiguration } from 'selectors/configuration'
+import { resetConfiguration } from 'reducers/configuration'
import InfoView from 'components/infoView'
import ConfigurationForm from 'components/configurationForm'
import ConfigurationView from 'components/configurationView'
diff --git a/assets/components/themeSwitcher/index.js b/assets/components/themeSwitcher/index.js
index efba05d..ddb429d 100644
--- a/assets/components/themeSwitcher/index.js
+++ b/assets/components/themeSwitcher/index.js
@@ -1,16 +1,16 @@
-import React, {useEffect, useRef} from 'react'
-import {useDispatch, useSelector} from 'react-redux'
-import {settingsToggleTheme} from 'reducers/settings'
+import React, { useEffect, useRef } from 'react'
+import { useDispatch, useSelector } from 'react-redux'
+import { settingsToggleTheme } from 'reducers/settings'
import classnames from 'classnames'
import LocalStorage from 'lib/localStorage'
-import {APP_THEMES_LIGHT, APP_THEMES_DARK} from 'reducers/settings/constants'
+import { APP_THEMES_LIGHT, APP_THEMES_DARK } from 'reducers/settings/constants'
import './theme-switcher.css'
const ThemeSwitcher = () => {
const htmlRoot = useRef()
const dispatch = useDispatch()
- const theme = useSelector(({settings}) => settings.theme)
+ const theme = useSelector(({ settings }) => settings.theme)
useEffect(() => {
htmlRoot.current = document.querySelector(':root')
diff --git a/assets/hooks/useIsMounted.js b/assets/hooks/useIsMounted.js
index 403b875..b4310dc 100644
--- a/assets/hooks/useIsMounted.js
+++ b/assets/hooks/useIsMounted.js
@@ -1,4 +1,4 @@
-import {useEffect, useRef} from 'react'
+import { useEffect, useRef } from 'react'
export const useIsMounted = () => {
const mounted = useRef(false)
diff --git a/assets/pages/app.js b/assets/pages/app.js
index af9badf..1c4b819 100644
--- a/assets/pages/app.js
+++ b/assets/pages/app.js
@@ -3,8 +3,8 @@ import GithubCorner from 'components/githubCorner'
import AppUpdate from 'components/appUpdate'
import ThemeSwitcher from 'components/themeSwitcher'
import classnames from 'classnames'
-import {matchPath} from 'react-router'
-import {Link, useLocation, Outlet} from 'react-router-dom'
+import { matchPath } from 'react-router'
+import { Link, useLocation, Outlet } from 'react-router-dom'
import './app.css'
diff --git a/assets/reducers/configuration/constants.js b/assets/reducers/configuration/constants.js
index e50cd54..2472a75 100644
--- a/assets/reducers/configuration/constants.js
+++ b/assets/reducers/configuration/constants.js
@@ -1,6 +1,6 @@
// postgresql versions
-export const DEFAULT_DB_VERSION = 14
-export const DB_VERSIONS = [DEFAULT_DB_VERSION, 13, 12, 11, 10, 9.6, 9.5]
+export const DEFAULT_DB_VERSION = 15
+export const DB_VERSIONS = [DEFAULT_DB_VERSION, 14, 13, 12, 11, 10]
// os types
export const OS_LINUX = 'linux'
export const OS_WINDOWS = 'windows'
diff --git a/assets/reducers/configuration/index.js b/assets/reducers/configuration/index.js
index bed92b7..38959a6 100644
--- a/assets/reducers/configuration/index.js
+++ b/assets/reducers/configuration/index.js
@@ -1,5 +1,5 @@
-import {combineReducers} from 'redux'
-import {createAction, createReducer} from 'redux-act'
+import { combineReducers } from 'redux'
+import { createAction, createReducer } from 'redux-act'
import {
DEFAULT_DB_VERSION,
OS_LINUX,
diff --git a/assets/reducers/settings/index.js b/assets/reducers/settings/index.js
index fb4cf78..cade61c 100644
--- a/assets/reducers/settings/index.js
+++ b/assets/reducers/settings/index.js
@@ -1,6 +1,6 @@
-import {combineReducers} from 'redux'
-import {createAction, createReducer} from 'redux-act'
-import {submitConfiguration} from 'reducers/configuration'
+import { combineReducers } from 'redux'
+import { createAction, createReducer } from 'redux-act'
+import { submitConfiguration } from 'reducers/configuration'
import {
APP_THEMES_LIGHT,
APP_THEMES_DARK,
diff --git a/assets/reducers/sw.js b/assets/reducers/sw.js
index 14b0de9..78b3c90 100644
--- a/assets/reducers/sw.js
+++ b/assets/reducers/sw.js
@@ -1,5 +1,5 @@
-import {combineReducers} from 'redux'
-import {createAction, createReducer} from 'redux-act'
+import { combineReducers } from 'redux'
+import { createAction, createReducer } from 'redux-act'
export const readyToUpdated = createAction('Ready to update SW')
export const updating = createAction('Updating SW cache')
diff --git a/assets/redux/rootReducer.js b/assets/redux/rootReducer.js
index c215494..1790fe8 100644
--- a/assets/redux/rootReducer.js
+++ b/assets/redux/rootReducer.js
@@ -1,8 +1,8 @@
-import {combineReducers} from 'redux'
+import { combineReducers } from 'redux'
-import {reducer as configuration} from 'reducers/configuration'
-import {reducer as settings} from 'reducers/settings'
-import {reducer as sw} from 'reducers/sw'
+import { reducer as configuration } from 'reducers/configuration'
+import { reducer as settings } from 'reducers/settings'
+import { reducer as sw } from 'reducers/sw'
export default combineReducers({
configuration,
diff --git a/assets/redux/store.js b/assets/redux/store.js
index 6c3e601..d9f8063 100644
--- a/assets/redux/store.js
+++ b/assets/redux/store.js
@@ -1,7 +1,7 @@
import config from 'config'
-import {createStore, applyMiddleware} from 'redux'
-import {createLogger} from 'redux-logger'
-import {loggers} from 'redux-act'
+import { createStore, applyMiddleware } from 'redux'
+import { createLogger } from 'redux-logger'
+import { loggers } from 'redux-act'
import rootReducer from './rootReducer'
export const initializeStore = (preloadedState = null) => {
diff --git a/assets/root.js b/assets/root.js
index ffb4706..da3d0c4 100644
--- a/assets/root.js
+++ b/assets/root.js
@@ -1,10 +1,10 @@
import React from 'react'
import PropTypes from 'prop-types'
-import {Provider} from 'react-redux'
-import {BrowserRouter as Router} from 'react-router-dom'
+import { Provider } from 'react-redux'
+import { BrowserRouter as Router } from 'react-router-dom'
import AppWrapper from './appWrapper'
-const Root = ({store}) => (
+const Root = ({ store }) => (
<Provider store={store} key="provider">
<Router>
<AppWrapper />
diff --git a/assets/selectors/__tests__/configuration.js b/assets/selectors/__tests__/configuration.js
index ba337ed..d89655a 100644
--- a/assets/selectors/__tests__/configuration.js
+++ b/assets/selectors/__tests__/configuration.js
@@ -161,30 +161,22 @@ describe('parallelSettings', () => {
it('less 2 cpu provided', () => {
expect(parallelSettings({
configuration: {
- dbVersion: 9.6,
+ dbVersion: 14,
cpuNum: 1
}
})).toEqual([])
})
- it('postgresql 9.5', () => {
+ it('postgresql 13', () => {
expect(parallelSettings({
configuration: {
- dbVersion: 9.5,
+ dbVersion: 13,
cpuNum: 12
}
})).toEqual([
- {key: 'max_worker_processes', value: 12}
- ])
- })
- it('postgresql 9.6', () => {
- expect(parallelSettings({
- configuration: {
- dbVersion: 9.6,
- cpuNum: 12
- }
- })).toEqual([
- {key: 'max_worker_processes', value: 12},
- {key: 'max_parallel_workers_per_gather', value: 4}
+ { key: 'max_worker_processes', value: 12 },
+ { key: 'max_parallel_workers_per_gather', value: 4 },
+ { key: 'max_parallel_workers', value: 12 },
+ { key: 'max_parallel_maintenance_workers', value: 4 }
])
})
it('postgresql 10', () => {
@@ -194,9 +186,9 @@ describe('parallelSettings', () => {
cpuNum: 12
}
})).toEqual([
- {key: 'max_worker_processes', value: 12},
- {key: 'max_parallel_workers_per_gather', value: 4},
- {key: 'max_parallel_workers', value: 12}
+ { key: 'max_worker_processes', value: 12 },
+ { key: 'max_parallel_workers_per_gather', value: 4 },
+ { key: 'max_parallel_workers', value: 12 }
])
})
@@ -207,9 +199,9 @@ describe('parallelSettings', () => {
cpuNum: 31
}
})).toEqual([
- {key: 'max_worker_processes', value: 31},
- {key: 'max_parallel_workers_per_gather', value: 4},
- {key: 'max_parallel_workers', value: 31}
+ { key: 'max_worker_processes', value: 31 },
+ { key: 'max_parallel_workers_per_gather', value: 4 },
+ { key: 'max_parallel_workers', value: 31 }
])
})
@@ -221,10 +213,10 @@ describe('parallelSettings', () => {
dbType: 'dw'
}
})).toEqual([
- {key: 'max_worker_processes', value: 31},
- {key: 'max_parallel_workers_per_gather', value: 16},
- {key: 'max_parallel_workers', value: 31},
- {key: 'max_parallel_maintenance_workers', value: 4}
+ { key: 'max_worker_processes', value: 31 },
+ { key: 'max_parallel_workers_per_gather', value: 16 },
+ { key: 'max_parallel_workers', value: 31 },
+ { key: 'max_parallel_maintenance_workers', value: 4 }
])
})
})
diff --git a/assets/selectors/configuration.js b/assets/selectors/configuration.js
index 4e51991..7d63627 100644
--- a/assets/selectors/configuration.js
+++ b/assets/selectors/configuration.js
@@ -1,4 +1,4 @@
-import {createSelector} from 'reselect'
+import { createSelector } from 'reselect'
import {
OS_WINDOWS,
OS_MAC,
@@ -39,13 +39,6 @@ const getDbDefaultValues = createSelector(
[getDBVersion],
(dbVersion) => (
{
- 9.5: {
- ['max_worker_processes']: 8
- },
- 9.6: {
- ['max_worker_processes']: 8,
- ['max_parallel_workers_per_gather']: 0
- },
10: {
['max_worker_processes']: 8,
['max_parallel_workers_per_gather']: 2,
@@ -70,6 +63,11 @@ const getDbDefaultValues = createSelector(
['max_worker_processes']: 8,
['max_parallel_workers_per_gather']: 2,
['max_parallel_workers']: 8
+ },
+ 15: {
+ ['max_worker_processes']: 8,
+ ['max_parallel_workers_per_gather']: 2,
+ ['max_parallel_workers']: 8
}
}[dbVersion]
)
@@ -157,45 +155,30 @@ export const maintenanceWorkMem = createSelector(
)
export const checkpointSegments = createSelector(
- [getDBVersion, getDBType],
- (dbVersion, dbType) => {
- if (dbVersion < 9.5) {
- return [
- {
- key: 'checkpoint_segments',
- value: ({
- [DB_TYPE_WEB]: 32,
- [DB_TYPE_OLTP]: 64,
- [DB_TYPE_DW]: 128,
- [DB_TYPE_DESKTOP]: 3,
- [DB_TYPE_MIXED]: 32
- }[dbType])
- }
- ]
- } else {
- return [
- {
- key: 'min_wal_size',
- value: ({
- [DB_TYPE_WEB]: (1024 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
- [DB_TYPE_OLTP]: (2048 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
- [DB_TYPE_DW]: (4096 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
- [DB_TYPE_DESKTOP]: (100 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
- [DB_TYPE_MIXED]: (1024 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB'])
- }[dbType])
- },
- {
- key: 'max_wal_size',
- value: ({
- [DB_TYPE_WEB]: (4096 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
- [DB_TYPE_OLTP]: (8192 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
- [DB_TYPE_DW]: (16384 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
- [DB_TYPE_DESKTOP]: (2048 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
- [DB_TYPE_MIXED]: (4096 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB'])
- }[dbType])
- }
- ]
- }
+ [getDBType],
+ (dbType) => {
+ return [
+ {
+ key: 'min_wal_size',
+ value: ({
+ [DB_TYPE_WEB]: (1024 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
+ [DB_TYPE_OLTP]: (2048 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
+ [DB_TYPE_DW]: (4096 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
+ [DB_TYPE_DESKTOP]: (100 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
+ [DB_TYPE_MIXED]: (1024 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB'])
+ }[dbType])
+ },
+ {
+ key: 'max_wal_size',
+ value: ({
+ [DB_TYPE_WEB]: (4096 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
+ [DB_TYPE_OLTP]: (8192 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
+ [DB_TYPE_DW]: (16384 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
+ [DB_TYPE_DESKTOP]: (2048 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB']),
+ [DB_TYPE_MIXED]: (4096 * SIZE_UNIT_MAP['MB'] / SIZE_UNIT_MAP['KB'])
+ }[dbType])
+ }
+ ]
}
)
@@ -266,29 +249,26 @@ export const effectiveIoConcurrency = createSelector(
export const parallelSettings = createSelector(
[getDBVersion, getDBType, getCPUNum],
(dbVersion, dbType, cpuNum) => {
- if (dbVersion < 9.5 || cpuNum < 2) {
+ if (cpuNum < 4) {
return []
}
+ let workersPerGather = Math.ceil(cpuNum / 2)
+
+ if (dbType !== DB_TYPE_DW && workersPerGather > 4) {
+ workersPerGather = 4 // no clear evidence, that each new worker will provide big benefit for each noew core
+ }
+
let config = [
{
key: 'max_worker_processes',
value: cpuNum
- }
- ]
-
- if (dbVersion >= 9.6) {
- let workersPerGather = Math.ceil(cpuNum / 2)
-
- if (dbType !== DB_TYPE_DW && workersPerGather > 4) {
- workersPerGather = 4 // no clear evidence, that each new worker will provide big benefit for each noew core
- }
-
- config.push({
+ },
+ {
key: 'max_parallel_workers_per_gather',
value: workersPerGather
- })
- }
+ }
+ ]
if (dbVersion >= 10) {
config.push({
diff --git a/assets/sw.js b/assets/sw.js
index 32c0649..91b4bc3 100644
--- a/assets/sw.js
+++ b/assets/sw.js
@@ -1,6 +1,6 @@
-import {clientsClaim} from 'workbox-core'
-import {precacheAndRoute} from 'workbox-precaching/precacheAndRoute'
-import {cleanupOutdatedCaches} from 'workbox-precaching/cleanupOutdatedCaches'
+import { clientsClaim } from 'workbox-core'
+import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute'
+import { cleanupOutdatedCaches } from 'workbox-precaching/cleanupOutdatedCaches'
const sha256 = (message) => {
// encode as UTF-8
@@ -29,9 +29,9 @@ cleanupOutdatedCaches()
sha256(JSON.stringify(cachedAssets.sort())).then((rev) => {
precacheAndRoute([
- {url: '/index.html', revision: `${rev}-v1`},
- {url: '/about.html', revision: `${rev}-v1`},
- {url: '/manifest.webmanifest', revision: `${rev}-v1`}
+ { url: '/index.html', revision: `${rev}-v1` },
+ { url: '/about.html', revision: `${rev}-v1` },
+ { url: '/manifest.webmanifest', revision: `${rev}-v1` }
])
})
diff --git a/assets/swWindow.js b/assets/swWindow.js
index 7c41ff7..e56be96 100644
--- a/assets/swWindow.js
+++ b/assets/swWindow.js
@@ -1,5 +1,5 @@
-import {Workbox, messageSW} from 'workbox-window'
-import {readyToUpdated} from 'reducers/sw'
+import { Workbox, messageSW } from 'workbox-window'
+import { readyToUpdated } from 'reducers/sw'
let wb = null
let wbRegistration = null
@@ -10,7 +10,7 @@ export const skipWaitingMessageAndReload = () => {
if (wbRegistration && wbRegistration.waiting) {
// Send a message to the waiting service worker,
// instructing it to activate.
- messageSW(wbRegistration.waiting, {type: 'SKIP_WAITING'})
+ messageSW(wbRegistration.waiting, { type: 'SKIP_WAITING' })
}
}