Refactor on applyPatch to prepare for multi-patch#453
Open
ACornuIGN wants to merge 2 commits into
Open
Conversation
ftoromanoff
reviewed
Jun 23, 2026
Comment on lines
+449
to
+470
| promisesCreatePatch.push(createPatch(aCog, | ||
| feature, | ||
| feature.properties.color, | ||
| feature.properties.opiName, | ||
| patchIsAuto ? feature.properties.colorSec : null, | ||
| patchIsAuto ? feature.properties.opiNameSec : null, | ||
| opi.with_rgb, | ||
| opi.with_ir, | ||
| overviews, | ||
| dirCache, | ||
| idBranch, | ||
| patchIsAuto)); | ||
| }); | ||
| debug('~Promise.all'); | ||
| const patchOnCogs = await Promise.all(promisesCreatePatch); | ||
| debug('~process patch'); | ||
|
|
||
| if (feature.properties.is_auto) { | ||
| await processSemiAutoPatch(dirCache, idBranch, patchOnCogs, geojsonPath); | ||
| } else { | ||
| await processPolygonPatch(dirCache, overviews, idBranch, patchOnCogs, newPatchNum); | ||
| } |
Collaborator
There was a problem hiding this comment.
Pour des raisons de rapidité, limiter le nombre d'await en essayant de chainer les promesses.
| debug('~~Semi-auto patch'); | ||
| const urlOutputData = `${dirCache}/result_ozcpp_idBr${idBranch}`; | ||
| dirTmp = urlOutputData; | ||
| await ozCppExe(patchOnCogs, urlOutputData, geojsonPath); |
Collaborator
There was a problem hiding this comment.
pourquoi faire un await ici, sachatn que l'in fait un autre await a l'appel de cette fonction. (mettre return a la place)
| '--verbose', | ||
| ); | ||
| return new Promise((res, rej) => { | ||
| execFile(ozExe, arrArgs, { env: { PROJ_LIB: process.env.PROJ_LIB } }, |
Collaborator
There was a problem hiding this comment.
Est ce toujours utile que execFile soit encapsulé dans une promesse ?
| patches.forEach((patch) => { | ||
| } | ||
|
|
||
| async function renameCogs(pgClient, dirCache, idBranch, patchOnCogs, patchId, newPatchNum) { |
Collaborator
There was a problem hiding this comment.
A retravailler. La fonction ne fais pas ce que son nom indique. (Sortir le forEach et renameCog())
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-factorisation de
applyPatchen plusieurs petites fonctions pour une meilleure compréhension de la fonction et pour la préparation au passage au multi patchRe-factorisation de
insertPatchdansdb.jspour une requête plus robuste et pour réduire le nombre de requête de l'api vers la base de données