Skip to content

Can't cache python requirements due to updated last modification time #721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dongho-jung opened this issue Sep 18, 2022 · 1 comment
Closed

Comments

@dongho-jung
Copy link

as the title suggests, python requirements aren't being cached due to updated last modification time.

serverless-python-requirements can cache python requirements with lambda layer.
but in some cases, it can't.

I've investigated this issue for several days:

  • serverless says the hash of new pythonRequirements.zip is different with the hash of one in S3, so it should be uploaded again
  • however, when I compare all the files in local pythonRequirements.zip and S3 pythonRequirements.zip, their contents are all the same
  • finally found that, the last modification time of files is different..

this issue is mentioned before though, the problem is still exist.

In code, I think below snippet should fix this issue, but it couldn't its job.

// necessary to get the same hash when zipping the same content
date: new Date(0),

and I also found that it seems below snippet broke caching

// We'll "touch" the folder, as to bring it to the start of the FIFO cache
fse.utimesSync(workingReqsFolder, new Date(), new Date());

I don't know what the FIFO cache is in this context... but after I comment these lines out, the cache works like a charm.

please any comment on this. thanks

@dongho-jung
Copy link
Author

nevermind. I was using 5.1.1 and I updated to 5.4.0 and the issue is gone. sorry for inappropriate issue.

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

No branches or pull requests

1 participant