mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
feat: console logs for identifiers on debug only
This commit is contained in:
parent
548af312a7
commit
b7dcf30578
@ -50,7 +50,7 @@ self.getUniqueAlbumIdentifier = async res => {
|
||||
const identifier = randomstring.generate(config.uploads.albumIdentifierLength)
|
||||
|
||||
if (self.onHold.has(identifier)) {
|
||||
logger.log(`Identifier ${identifier} is currently held by another album (${i + 1}/${utils.idMaxTries}).`)
|
||||
logger.debug(`Identifier ${identifier} is currently held by another album (${i + 1}/${utils.idMaxTries}).`)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -63,12 +63,14 @@ self.getUniqueAlbumIdentifier = async res => {
|
||||
.first()
|
||||
if (album) {
|
||||
self.onHold.delete(identifier)
|
||||
logger.log(`Album with identifier ${identifier} already exists (${i + 1}/${utils.idMaxTries}).`)
|
||||
logger.debug(`Album with identifier ${identifier} already exists (${i + 1}/${utils.idMaxTries}).`)
|
||||
continue
|
||||
}
|
||||
|
||||
// Unhold identifier once the Response has been sent
|
||||
if (res) {
|
||||
// Keep in an array for future-proofing
|
||||
// if a single Request needs to generate multiple album identifiers
|
||||
if (!res.locals.identifiers) {
|
||||
res.locals.identifiers = []
|
||||
res.once('finish', () => { self.unholdAlbumIdentifiers(res) })
|
||||
|
@ -157,7 +157,7 @@ self.getUniqueUploadIdentifier = async (length, extension = '', res) => {
|
||||
if (queryDatabaseForIdentifierMatch) {
|
||||
// If must query database for identifiers matches
|
||||
if (self.onHold.has(identifier)) {
|
||||
logger.log(`Identifier ${identifier} is currently held by another upload (${i + 1}/${utils.idMaxTries}).`)
|
||||
logger.debug(`Identifier ${identifier} is currently held by another upload (${i + 1}/${utils.idMaxTries}).`)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ self.getUniqueUploadIdentifier = async (length, extension = '', res) => {
|
||||
.first()
|
||||
if (file) {
|
||||
self.onHold.delete(identifier)
|
||||
logger.log(`Identifier ${identifier} is already in use (${i + 1}/${utils.idMaxTries}).`)
|
||||
logger.debug(`Identifier ${identifier} is already in use (${i + 1}/${utils.idMaxTries}).`)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ self.getUniqueUploadIdentifier = async (length, extension = '', res) => {
|
||||
try {
|
||||
const name = identifier + extension
|
||||
await paths.access(path.join(paths.uploads, name))
|
||||
logger.log(`${name} is already in use (${i + 1}/${utils.idMaxTries}).`)
|
||||
logger.debug(`${name} is already in use (${i + 1}/${utils.idMaxTries}).`)
|
||||
continue
|
||||
} catch (error) {
|
||||
// Re-throw non-ENOENT error
|
||||
|
Loading…
Reference in New Issue
Block a user