UNPKG

1.07 kBJavaScriptView Raw
1'use strict'
2
3const cli = require('heroku-cli-util')
4const settings = require('../../lib/setter')
5
6function 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
13module.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.
18Applications 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}