gitdocs icon indicating copy to clipboard operation
gitdocs copied to clipboard

Perf: Do not change temporary folders of git sources

Open ptbrowne opened this issue 7 years ago • 1 comments

When running gitdocs serve with many sources from git repositories, the git repositories are not conserved, and are re-fetched which can be a problem for large git repositories. Would you consider keeping the temporary repositories ? I could make a PR :)

ptbrowne avatar Dec 28 '18 13:12 ptbrowne

At the moment I quickly and dirtily patched gitdocs :

In src/sources/git.js

function tempDir () {
  // tmp.setGracefulCleanup()

  // const dir = tmp.dirSync({
  //   prefix: 'gitdocs-',
  // })

  return '/tmp/gitdocs/'

~~It is not working yet since when starting, gitdocs seems to be removing all temporary folders. I am still searching where it does that.~~

In src/utils/config.js

  // await fs.emptyDir(masterConfig.temp)

I think there should be an option to

  • bypass the cleaning of the temporary directory
  • keep the git clones even after the server has been closed

It is an important perf improvement for me as the server otherwise starts in more than 3 minutes vs 10s if the temporary directory is not emptied.

What do you think ?

ptbrowne avatar Dec 28 '18 13:12 ptbrowne