[misc] run format_fix and lint:fix

This commit is contained in:
Jakob Ackermann
2021-07-13 12:04:48 +01:00
parent 631873fc83
commit f285e503b4
66 changed files with 1315 additions and 1302 deletions
+9 -9
View File
@@ -76,14 +76,14 @@ async function update(contentDir, filePath, size, compileTime) {
if (bytesRead !== object.size) {
throw new OError('could not read full chunk', {
object,
bytesRead
bytesRead,
})
}
const idxObj = buffer.indexOf('obj')
if (idxObj > 100) {
throw new OError('objectId is too large', {
object,
idxObj
idxObj,
})
}
const objectIdRaw = buffer.subarray(0, idxObj)
@@ -95,7 +95,7 @@ async function update(contentDir, filePath, size, compileTime) {
objectId: objectIdRaw.toString(),
start: object.offset + objectIdRaw.byteLength,
end: object.endOffset,
hash
hash,
}
ranges.push(range)
@@ -168,7 +168,7 @@ class HashFileTracker {
const statePath = getStatePath(this.contentDir)
const blob = JSON.stringify({
hashAge: Array.from(this.hashAge.entries()),
hashSize: Array.from(this.hashSize.entries())
hashSize: Array.from(this.hashSize.entries()),
})
const atomicWrite = statePath + '~'
try {
@@ -198,7 +198,7 @@ class HashFileTracker {
return reclaimedSpace
}
await promiseMapWithLimit(10, hashes, async (hash) => {
await promiseMapWithLimit(10, hashes, async hash => {
await fs.promises.unlink(Path.join(this.contentDir, hash))
this.hashAge.delete(hash)
reclaimedSpace += this.hashSize.get(hash)
@@ -251,7 +251,7 @@ function getDeadlineChecker(compileTime) {
throw new TimedOutError(stage, {
completedStages,
lastStage: lastStage.stage,
diffToLastStage: now - lastStage.now
diffToLastStage: now - lastStage.now,
})
}
completedStages++
@@ -261,13 +261,13 @@ function getDeadlineChecker(compileTime) {
function promiseMapWithLimit(concurrency, array, fn) {
const limit = pLimit(concurrency)
return Promise.all(array.map((x) => limit(() => fn(x))))
return Promise.all(array.map(x => limit(() => fn(x))))
}
module.exports = {
HASH_REGEX: /^[0-9a-f]{64}$/,
update: callbackify(update),
promises: {
update
}
update,
},
}