maxmantz / redux-oidc-example

Small ReactJS application to demonstrate the usage of redux-oidc
MIT License
108 stars 68 forks source link

checkSession begin run hundreds of times per second #17

Closed carleryd closed 6 years ago

carleryd commented 6 years ago

I set up my store with the userManager from redux-oidc, previously with version 2.2.1 and now with 3.0.0-beta14 and at both points the project I have experience a large bump in CPU usage when implementing the userManager, on a Macbook Pro 2017 the CPU usage increases from under 10% to between 15-25% and I have measured performance and see that checkSession, among other functions, are run extremely often.

Image of Chrome performance measurement with userManager

screen shot 2018-02-01 at 10 49 11

Image of Chrome performance measurement without userManager

screen shot 2018-02-01 at 11 49 40

This is the code implementing the OIDC, without it the app runs fine.

const userManager = createUserManager(config.authConfig);

const store = createStore(reducers, composeWithDevTools(applyMiddleware(middleware, thunkMiddleware)));

loadUser(store, userManager);

with authConfig

  authConfig: {
    authority: "https://some-website.net",
    client_id: "js",
    redirect_uri: "https://some-website.net/callback",
    response_type: "id_token token",
    scope: "openid profile api1",
    post_logout_redirect_uri: "https://some-website.net",
    silent_redirect_uri: "https://some-website.net/silent_renew.html",
    automaticSilentRenew: true,
    filterProtocolClaims: true,
    loadUserInfo: true
  },

Any clue what is causing this? What is the checkSession actually doing and can it be run less often?