• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TykTechnologies / tyk / 5129

Build:
DEFAULT BRANCH: master
Ran 13 Jun 2018 01:13PM UTC
Jobs 2
Files 103
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
5129

push

travis-ci

web-flow
Do less session updates, remove hash check (#1770)

Previously, to know if the session needs to be updated or not, we had to generate some session hash (by serializing an object to msgpack), and if a hash of new session does not match a hash of original session, we triggered an update. This was causing unnecessary updates because change in any field changed hash, and hashing itself was quite slow. 

There are cases when fields changed in existing session object do not need to trigger updates. And this PR introduce the new way of manually specifying places when storage update is needed for the session or not. If you want update session, just call `ctxScheduleSessionUpdate(r)`, where `r` is current request object. It will set the request context boolean variable, and will schedule update, at the end of the request. As a big bonus, it will restrict running more than one session update per request.

The main showcases for this feature are applying policies and quota updates. 

In case of `ApplyPolicy`, we run this function every time, on each request, so session object always gets fresh data from policy, it does not really depend on data from original session object, except policy_id. Previously when policy got changed, it updated session, its `hash` changed as well, and it was triggering an update for each token. Now, `ApplyPolicies` never triggers session update. And keys when we need to see current key permissions with Tyk API, covered by running  `ApplyPolicies` one more time inside API call.

In case of quotas, on each request, we change `session.QuotaRemaining` field on each request, which triggers session update too. But in fact, `QuotaRemaining` always computed dynamically, and value from original session used only for Keys API, when you retrieve key and need to know current quota usage. Now, quota updates never trigger session update as well, which means minus one redis call in all cases when rate limiting used. Keys API now separately fe... (continued)

152 of 152 new or added lines in 18 files covered. (100.0%)

9251 of 15663 relevant lines covered (59.06%)

1.3 hits per line

Jobs
ID Job ID Ran Files Coverage
1 5129.1 (LATEST_GO=true) 13 Jun 2018 01:15PM UTC 0
58.47
Travis Job 5129.1
2 5129.2 (LATEST_GO=true) 13 Jun 2018 01:13PM UTC 0
59.06
Travis Job 5129.2
Source Files on build 5129
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #5129
  • 5bbab7f6 on github
  • Prev Build on master (#5111)
  • Next Build on master (#5134)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc