From cd0b9a7f552d7b7c7a7de41655d05076dbd45829 Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Wed, 27 Sep 2023 21:43:52 +0200 Subject: [PATCH] code design --- config.json | 4 ++-- services/database/albums.js | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/config.json b/config.json index 2f2b3bf..15616a3 100644 --- a/config.json +++ b/config.json @@ -10,12 +10,12 @@ "http://localhost" ], "database": { - "host": "localhost", + "host": "database", "port": 27017, "name": "webplay" }, "redis": { - "host": "localhost", + "host": "redis", "port": 6379 }, "album_cover_files": [ diff --git a/services/database/albums.js b/services/database/albums.js index e8258cb..9f33e44 100644 --- a/services/database/albums.js +++ b/services/database/albums.js @@ -320,11 +320,9 @@ exports.randomCovers = function (count, size, callback) { .toArray((err, result) => { let res = []; if (result.length > count) { - let i = 0; - while (i < count) { + while (count-- > 0) { let rnd = randomNumber(0, result.length); res.push(result[rnd]); - i++; } callback(res); } else {