Base solution for your next web application
Open Closed

Issue with SettingManager.GetSettingValueForUserAsync #11561


User avatar
0
lschelvan created

Hi, we have an issue with GetSettingValueForUserAsync not returning an updated value. It appears to be returning a cached value.

We are using the below line to change/ set a new setting value:

await SettingManager.ChangeSettingForUserAsync(AbpSession.ToUserIdentifier(), AppSettings.WMS.InventoryStockViewSettings.InventoryLotGroupBy, ((bool)input.InventoryLotGroupBy).ToString());

Then we are using the below to get the updated value from DB:

userSettings.InventoryLotGroupBy = await SettingManager.GetSettingValueForUserAsync<bool>(AppSettings.WMS.InventoryStockViewSettings.InventoryLotGroupBy, AbpSession.ToUserIdentifier());

The API endpoint for getting Updated values is returning old values to the client side most of the time (the values have been updated as expected in DB). It works fine after I hard reload the page/Frontend.

Note: Everything works fine on local, the issue is occurring only on live (Azure app service).


7 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @lschelvan

    Do you host more than 1 instance of your app on Azure ?

    Thanks,

  • User Avatar
    0
    lschelvan created

    Currently there is only 1 instance.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @lschelvan

    Could you also share the setting definition of AppSettings.WMS.InventoryStockViewSettings.InventoryLotGroupBy, we will try to reproduce this problem on our side.

    At the moment, I don't have a clue about the problem yet.

  • User Avatar
    0
    lschelvan created

    Here's the definition. We have several other similar settings that are being read in the same manner, and they exhibit the same caching behavior.

    public bool? InventoryLotGroupBy { get; set; } = false;

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I mean the setting definition in AppSettingProvider.cs, could you share that as well ?

  • User Avatar
    0
    lschelvan created

    new SettingDefinition( AppSettings.WMS.InventoryStockViewSettings.InventoryLotGroupBy, GetFromAppSettings(AppSettings.WMS.InventoryStockViewSettings.InventoryLotGroupBy, "false"), scopes: SettingScopes.User, isVisibleToClients: true, isEncrypted:false),

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @lschelvan

    Thanks. Unfortunately, we couldn't reproduce this problem on our side. Is it possible to access your live app with a test account ? If so, could you share it with [email protected] ?