Use helix-resolve-git-ref
kptdobe opened this issue · 4 comments
I assume the "caching" issues visible in adobe/helix-pages#17 are due to the fact that the helix-static action still uses direct git raw api calls (like https://raw.githubusercontent.com/kptdobe/helix-demo/master//style.css) which takes a bit of time to update.
Using https://github.com/adobe/helix-resolve-git-ref like in the pipeline (https://github.com/adobe/helix-pipeline/blob/master/src/utils/resolve-ref.js) should solve that pb.
similar to pipeline, we should check if the 'ref' is not already a sha. this gives the ability to fetch the sha already in the dispatch, and provide it to all actions.
So basically, this should happen before, in helix-experimental-dispatch and not here. Same for pipeline. But... the dispatch method tries multiple combinations, like content repo or static repo, htdocs path or root path. This will basically double the number of requests (get first the sha then call the corresponding action) in dispatch.
...and even worse. it needs to block until the resolve-ref has returned. in the worst case, it has 2 request more: 1 for the static-repo ref, and one for the content-repo ref. most of the times, those are the same, so only 1 request more.
additionally, we could cache the SHAs in the dispatch for 1 minute...
Closing this one in favor of adobe/helix-dispatch#3 where it should be addressed.