Skip to content
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

Memory Leak on Azure #167

Open
TubaBayraktutar opened this issue Dec 29, 2022 · 0 comments
Open

Memory Leak on Azure #167

TubaBayraktutar opened this issue Dec 29, 2022 · 0 comments

Comments

@TubaBayraktutar
Copy link

Hello,

I am using the latest version of redux-state-sync. As you can see in the graph below, the usage of RAM is constantly increasing.

Node version is 14.16.1

image

Store configuration;

import { createStore, applyMiddleware, compose } from 'redux';

import {
  createStateSyncMiddleware,
  withReduxStateSync,
  initStateWithPrevTab
} from 'redux-state-sync';

import Router from 'next/router';

import reducer from './reducer';

import middlewares from './middleware';
import { actionType } from './actions';

const composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;

const stateSyncConfig = {
  channel: 'my_project_redux_state_sync',
  whitelist: [
    actionType.StateClear,
    'StateMerge',
    'StatesMerge',
    'PrependToKey',
    'AddToKey',
    'RemoveFromKey'
  ]
};

export const initStore =
  (initialState = {
    apiUrl: process.env.API_URL || 'http://localhost:5000',
    auctionHubState: 'Initializing'
  }) => {
    console.log(JSON.stringify(process.env));
    const storeMiddlewares = [createStateSyncMiddleware(stateSyncConfig)];

    if (process.browser && Router.route === '/home') {

      storeMiddlewares.push(...middlewares);
    }

    const store =
      createStore(
        withReduxStateSync(reducer),
        initialState,
        composeEnhancers(
          applyMiddleware(...storeMiddlewares)
        )
      );

    if (process.browser && Router.route !== '/operator') {

      initStateWithPrevTab(store);
    }

    return store;
  };
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