Skip to content

buildVersionHash is not doing what is suppose to do #31

Open

Description

@dariomac-vix

Hi, buildVersionHash has a comment (and historically do this):

Walks the directory tree, finding files, generating a version hash

But from v.3.0.1, the code responsible for the hash creation (cachedMakeHash) is called from getVersionedPath. So, the comment is outdated but most important, the whole concept of

When you initialize this module, it crawls your public folder synchronously at startup, and pre-determines all the MD5 hashes for your static files. This slows down application startup slightly, but it keeps the runtime performance at its peak.

Now, the hash is generated only if the resource is called and make slow the first call of it.

I think that, or you change your code to match the documentation (and how historically works) or you change the description/comment.

Let me know what you think.

Activity

  1. XhmikosR commented on Apr 9, 2019

    @XhmikosR
    Collaborator

    You mean v3.1.0? You can always submit a PR :)

  2. dariomac-vix commented on Apr 9, 2019

    @dariomac-vix
    Author

    Yes... sorry, v3.1.0... and yes... I can submit a PR.

    I'm only asking because it was a big change and maybe it has some reason behind that I'm not aware. I'll test some changes locally and submit a PR asap.

  3. XhmikosR commented on Apr 9, 2019

    @XhmikosR
    Collaborator

    It was just a leftover I believe. Because the buildVersionHash does do what it says, but now it depends on cachedMakeHash so the comment(s) might need to be adapted..

  4. dariomac-vix commented on Apr 9, 2019

    @dariomac-vix
    Author

    Mmm but looking at the code I can't figure it out how it does what it says, because in any case call cachedMakeHash and that's is the only place that called crypto.createHash

  5. XhmikosR commented on Apr 9, 2019

    @XhmikosR
    Collaborator

    @Rush: do you have any comments since you were the author of the patch?

  6. Rush commented on Apr 9, 2019

    @Rush
    Contributor

    Comment is no longer valid. We shouldn't by default warm up the cache. (Perhaps optionally) Why would we slowdown the server upon every reload? Think of nodemon or node-dev in development.

  7. Rush commented on Apr 9, 2019

    @Rush
    Contributor

    See my previous PR for context #23

  8. dariomac-vix commented on Apr 9, 2019

    @dariomac-vix
    Author

    I think it can be optional as you say... With your context message I understand why you did that. Also, not only the comment is no longer valid, but parts of the readme.md too (as the one I quoted early).

    Tonight I'll update my PR trying to include changes in the readme.md

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions