1 | 'use strict'
|
2 |
|
3 | const cli = require('heroku-cli-util')
|
4 | const settings = require('../../lib/setter')
|
5 |
|
6 | function explain (setting) {
|
7 | if (setting.value) {
|
8 | return `When a deadlock is detected, a log message will be emitted in your application's logs.`
|
9 | }
|
10 | return `When a deadlock is detected, no log message will be emitted in your application's logs.`
|
11 | }
|
12 |
|
13 | module.exports = {
|
14 | topic: 'pg',
|
15 | command: 'settings:log-lock-waits',
|
16 | description: `Controls whether a log message is produced when a session waits longer than the deadlock_timeout to acquire a lock. deadlock_timeout is set to 1 second`,
|
17 | help: `Delays due to lock contention occur when multiple transactions are trying to access the same resource at the same time.
|
18 | Applications and their query patterns should try to avoid changes to many different tables within the same transaction.`,
|
19 | needsApp: true,
|
20 | needsAuth: true,
|
21 | args: [{name: 'value', optional: true}, {name: 'database', optional: true}],
|
22 | run: cli.command({preauth: true}, settings.generate('log_lock_waits', settings.boolean, explain))
|
23 | }
|