Skip to content

Commit

Permalink
commiting files to resolve issue and git pull
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghalya AL-Eshaq authored and Ghalya AL-Eshaq committed Sep 26, 2024
1 parent 391bd94 commit e6a0a77
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,23 @@ const DEFAULT_BATCH_SIZE = 100;

const sleep = util.promisify(setTimeout);

exports.processSortedSet = async function (setKey, process, options) {
options = options || {};
// I will reduce the complexity of the code by making helper functions outside the main function
// where the errors show

// helper functions:
// fixing error 1:
function processIsFunction(process) {
if (typeof process !== 'function') {
throw new Error('[[error:process-not-a-function]]');
}
}


exports.processSortedSet = async function (setKey, process, options) {
console.log('Hakaabi: Refactored code is running!');
options = options || {};

processIsFunction(process);

// Progress bar handling (upgrade scripts)
if (options.progress) {
Expand Down Expand Up @@ -68,6 +79,7 @@ exports.processSortedSet = async function (setKey, process, options) {
stop = start + options.batch - 1;
}
};
console.log('Hakaabi: Refactored code stopped running!');

exports.processArray = async function (array, process, options) {
options = options || {};
Expand Down

0 comments on commit e6a0a77

Please sign in to comment.