Skip to content

refactor: support passing plugins response handlers and middlware#30

Merged
chrisvogt merged 3 commits intomasterfrom
refactor-cache
May 25, 2019
Merged

refactor: support passing plugins response handlers and middlware#30
chrisvogt merged 3 commits intomasterfrom
refactor-cache

Conversation

@chrisvogt
Copy link
Member

This PR coincides with personal-api/plugin-instagram#4, and adds support for passing the Instagram plugin the success handlers, error handlers, and an Express middleware. My initial use case for this is to pass the cache middleware to the route attached by the plugin,

@chrisvogt chrisvogt added the release Bump version label May 24, 2019
@chrisvogt chrisvogt self-assigned this May 24, 2019
@codecov
Copy link

codecov bot commented May 25, 2019

Codecov Report

Merging #30 into master will decrease coverage by 34.1%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #30       +/-   ##
===========================================
- Coverage     100%   65.89%   -34.11%     
===========================================
  Files          19       20        +1     
  Lines         175      173        -2     
===========================================
- Hits          175      114       -61     
- Misses          0       59       +59
Impacted Files Coverage Δ
src/utils/getCache.js 100% <100%> (ø)
src/api/base.js 100% <100%> (ø) ⬆️
src/routes.js 100% <100%> (ø) ⬆️
src/database/services.js 22.22% <0%> (-77.78%) ⬇️
src/controllers/projects.js 40% <0%> (-60%) ⬇️
src/controllers/composite.js 42.85% <0%> (-57.15%) ⬇️
src/helpers/joinRepoToProject.js 55.55% <0%> (-44.45%) ⬇️
src/controllers/metas.js 55.55% <0%> (-44.45%) ⬇️
src/controllers/repositories.js 55.55% <0%> (-44.45%) ⬇️
src/controllers/profiles.js 55.55% <0%> (-44.45%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 541ee08...1ac6b91. Read the comment docs.

@chrisvogt
Copy link
Member Author

Example showing Instagram data being cached:

Before

before

After

after

@chrisvogt chrisvogt merged commit a6a7ab2 into master May 25, 2019
@chrisvogt chrisvogt deleted the refactor-cache branch May 25, 2019 17:42
@chrisvogt
Copy link
Member Author

This worked perfectly! Each call to the Instagram endpoint had been taking ~900ms. Now cached responses are returning in ~30ms.

Before

Screen Shot 2019-05-25 at 10 16 20 PM

After

Screen Shot 2019-05-25 at 10 17 10 PM

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

Labels

release Bump version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant