Skip to content

Commit

Permalink
fix(dashmate): doctor fails collecting to big logs (#2158)
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Sep 27, 2024
1 parent 769a936 commit 72bedbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions packages/dashmate/src/docker/DockerCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,23 @@ export default class DockerCompose {
* Logs
*
* @param {Config} config
* @return {Promise<void>}
* @param {string[]} services
* @param {Object} options
* @param {number} options.tail
* @return {Promise<{exitCode: number | null, out: string, err: string}>}
*/
async logs(config, services = []) {
async logs(config, services = [], options = {}) {
await this.throwErrorIfNotInstalled();

const args = [...services];
if (options.tail) {
args.unshift('--tail', options.tail.toString());
}

const commandOptions = this.#createOptions(config);

try {
return dockerCompose.logs(services, this.#createOptions(config));
return await dockerCompose.logs(args, commandOptions);
} catch (e) {
throw new DockerComposeError(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export default function collectSamplesTaskFactory(
services.map(async (service) => {
const [inspect, logs] = (await Promise.allSettled([
dockerCompose.inspectService(config, service.name),
dockerCompose.logs(config, [service.name]),
dockerCompose.logs(config, [service.name], { tail: 300000 }),
])).map((e) => e.value || e.reason);

if (logs?.out) {
Expand Down

0 comments on commit 72bedbe

Please sign in to comment.