Skip to content

Commit

Permalink
Fix no resending
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Sep 4, 2024
1 parent 4454aed commit c73ddd8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "domcloud-bridge",
"version": "0.56.0",
"version": "0.56.1",
"description": "Deployment runner for DOM Cloud",
"main": "app.js",
"engines": {
Expand Down
9 changes: 7 additions & 2 deletions src/controllers/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export async function runConfigInBackground(body, domain, sandbox, callback) {
chunkedLogData = ['Running deployment script... Please wait...\n'],
startTime = Date.now();
const write = new PassThrough();
const delay = 5000;
const headers = {
'Content-Type': 'text/plain; charset=UTF-8',
};
Expand All @@ -79,6 +80,9 @@ export async function runConfigInBackground(body, domain, sandbox, callback) {
console.error(e);
});
}
if (write && !write.writableEnded) {
setTimeout(periodicSender, delay).unref();
}
}
periodicSender();
write.on('data', (chunk) => {
Expand All @@ -89,6 +93,7 @@ export async function runConfigInBackground(body, domain, sandbox, callback) {
write.on('end', () => {
// and finish message with full log
if (callback) {
chunkedLogData = [];
const data = trimPayload(normalizeShellOutput(fullLogData));
request(callback, { data, headers, ...options })
.then(e => {
Expand All @@ -99,9 +104,9 @@ export async function runConfigInBackground(body, domain, sandbox, callback) {
}
});
try {
await runConfig(body || {}, domain + "", async (s) => {
await runConfig(body || {}, domain + "", (s) => {
console.log('> ' + s);
await writeAsync(write, s);
return writeAsync(write, s);
}, sandbox);
} catch (error) {
console.log('!> ', error);
Expand Down

0 comments on commit c73ddd8

Please sign in to comment.