Added settings file to easily adjust delays

This commit is contained in:
Will Boyd
2020-04-11 10:10:01 -04:00
parent b3983bda96
commit d8c513ff04
2 changed files with 10 additions and 2 deletions
+7
View File
@@ -0,0 +1,7 @@
// time in ms to wait between requesting image files
// increase this if you see timeouts or server errors
exports.image_file_request_delay = 500;
// time in ms to wait between saving Markdown files
// increase this if your file system becomes overloaded
exports.markdown_file_write_delay = 25;
+3 -2
View File
@@ -5,6 +5,7 @@ const path = require('path');
const requestPromiseNative = require('request-promise-native');
const shared = require('./shared');
const settings = require('./settings');
async function writeFilesPromise(posts, config) {
await writeMarkdownFilesPromise(posts, config);
@@ -46,7 +47,7 @@ async function writeMarkdownFilesPromise(posts, config ) {
item: post,
name: post.meta.slug,
destinationPath: getPostPath(post, config),
delay: index * 25
delay: index * settings.markdown_file_write_delay
}));
console.log('\nSaving posts...');
@@ -78,7 +79,7 @@ async function writeImageFilesPromise(posts, config) {
destinationPath: path.join(imagesDir, filename),
delay
};
delay += 100;
delay += settings.image_file_request_delay;
return payload;
});
});