Skip to content

wip: refactor abstract mapreduce#9177

Draft
emilygilberts wants to merge 4 commits intoapache:masterfrom
emilygilberts:refactor-abstract-mapreduce
Draft

wip: refactor abstract mapreduce#9177
emilygilberts wants to merge 4 commits intoapache:masterfrom
emilygilberts:refactor-abstract-mapreduce

Conversation

@emilygilberts
Copy link
Contributor

@emilygilberts emilygilberts commented Feb 19, 2026

did some ES6 refactoring:

  • converted functions updatePurgeSeq, saveKeyValues, createTask, getRecentPurges to async/await to replace promise chains

  • refactored postProcessAttatchments to accept the resolved result (res) directly, wich enables to remove the .then()` on the call

  • removed unneccessary promise wrappers around calls of:

  • postProcessAttatchments (is now invoked directly with the resolved result - instead of with .then() chaining)

  • queryPromised (the async function already returns a promise)

  • replaced the use of fin (final promise factory function) with try/finally block

  • removed the last var

  • rewrote the defaultsTo function that sets a default value if a promise throws a 404 error - which used to fit neatly into the.catch(defaultsTo(x).then(..) syntax, but couldn't be used anymore after the rewrite. I added an optional property parameter to the function, as we sometimes want to return the awaited result directly (ex. lastSeqDoc in saveKeyValues) and sometimes a property of it (ex. purqueSeq._rev in updatePurgeSeq). This part was most confusing for me - so I'm happy for any thoughts on it!

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants