Skip to content

Commit

Permalink
fix: EPIPE and ENOENT errors (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Rodríguez Baquero committed Feb 9, 2024
1 parent b9ad8e8 commit 22daaa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions container/shim/src/fetchers/lassie.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ function getSemanticErrorStatus(status, body) {
* @param {string} filename
*/
function sendBlockResponse(res, block, cidObj, filename) {
if (res.writableEnded) return;

res.status(200);
res.set("content-length", Buffer.byteLength(block));
res.set("content-type", "application/vnd.ipld.raw");
Expand Down
8 changes: 7 additions & 1 deletion container/shim/src/modules/log_ingestor.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ async function executeLogIngestor() {
if (!(await isFileAccessible(logFile))) continue;

// stream the log file and parse the lines
const read = await readLines(logFile);
let read;
try {
read = await readLines(logFile);
} catch (err) {
if (err.code === "ENOENT") continue;
throw err;
}

const logs = [];
for (let i = 0; i < read.lines.length; i++) {
Expand Down

0 comments on commit 22daaa2

Please sign in to comment.