This file (1kB) exceeds the allowed full mode (48 kb) size. The editor full height is disabled, only scrolling is allowed.
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height mode.
import * as sharedIoRedis from '../../shared.mjs'
const consolePrefix = 'socket.io timeseries alter'
export default async (options) => {
const {socket, payload} = options;
try {
sharedIoRedis.ensureReadonlyConnection({ socket })
const redis = socket.p3xrs.ioredis
const key = payload.key
const args = [key]
if (payload.retention !== undefined) {
args.push('RETENTION', parseInt(payload.retention))
}
if (payload.duplicatePolicy) {
args.push('DUPLICATE_POLICY', payload.duplicatePolicy)
}
if (payload.labels !== undefined) {
args.push('LABELS')
if (payload.labels && payload.labels.trim().length > 0) {
args.push(...payload.labels.trim().split(/\s+/))
}
}
console.info(consolePrefix, args)
await redis.call('TS.ALTER', ...args)
socket.emit(options.responseEvent, {
status: 'ok',
})
} catch (e) {
console.error(e)
socket.emit(options.responseEvent, {
status: 'error',
error: e.message,
})
}
}
| / | Focus search |
| ? | Show this help |
| Esc | Unfocus input |