[Bug] Remote Config: Setting MinimumFetchInternalInMilliseconds does not work as expected - quickstart-unity

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.5f1
  • Firebase Unity SDK version: 8.1.0
  • Source you installed the SDK: installed via unitypackage
  • Problematic Firebase Component: Remote Config
  • Other Firebase Components in use: Analytics, Messaging, Auth, Crashlytics
  • Additional SDKs you are using: Facebook, IronSource
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP (.NET 4.x)

[REQUIRED] Please describe the issue here:

Setting MinimumFetchInternalInMilliseconds does not seem to work as expected. For example, if it is set to 120000 (2 minutes), remote values are never fetched even after 2 minutes have elapsed. It seems as though the cached values never expire.

Steps to reproduce:

1.) Import Firebase packages (Analytics, Messaging, Remote Config, Crashlytics, Auth) 2.) Test Remote Config by setting MinimumFetchInternalInMillisecondsto 120000 (2 minutes) 3.) Call FirebaseRemoteConfig.DefaultInstance.FetchAsync();. It completes successfully but remote values are never fetched even after 2 minutes have elapsed (as indicated by info.FetchTime).

Relevant Code:

```c# // this example assumes that the dependency status check was successful (this.dependencyStatus == DependencyStatus.Available)

private void InitRemoteConfig() { Dictionary defaults = new Dictionary(); defaults.Add("leveltime", 300); defaults.Add("defaultcoins", 50);

FirebaseRemoteConfig.DefaultInstance.SetDefaultsAsync(defaults).ContinueWithOnMainThread(task =>
{
    var configSettings = new ConfigSettings();
    configSettings.MinimumFetchInternalInMilliseconds = 120000;
    FirebaseRemoteConfig.DefaultInstance.SetConfigSettingsAsync(configSettings).ContinueWithOnMainThread(task =>
    {
        this.FetchRemoteData();
    });
});

}

private Task FetchRemoteData() { Task fetchTask = FirebaseRemoteConfig.DefaultInstance.FetchAsync(); return fetchTask.ContinueWithOnMainThread(this.RemoteDataFetchComplete); }

private void RemoteDataFetchComplete(Task fetchTask) { if (fetchTask.IsCanceled) { print("FirebaseRemoteConfig fetch canceled"); } else if (fetchTask.IsFaulted) { print("FirebaseRemoteConfig fetch encountered an error."); } else if (fetchTask.IsCompleted) { print("FirebaseRemoteConfig fetch completed successfully!"); }

var info = FirebaseRemoteConfig.DefaultInstance.Info;
switch (info.LastFetchStatus)
{
    case LastFetchStatus.Success:
        FirebaseRemoteConfig.DefaultInstance.ActivateAsync().ContinueWithOnMainThread(task =>
        {
            // this part of the code is reached successfully but info.FetchTime never seems to update, even after more than 2 minutes have elapsed 
            print($"FirebaseRemoteConfig Remote data loaded and ready (last fetch time {info.FetchTime}).");
        });
        break;
    case LastFetchStatus.Failure:
        switch (info.LastFetchFailureReason)
        {
            case FetchFailureReason.Error:
                print("FirebaseRemoteConfig Fetch failed for unknown reason");
                break;
            case FetchFailureReason.Throttled:
                print("FirebaseRemoteConfig Fetch throttled until " + info.ThrottledEndTime);
                break;
        }
        break;
    case LastFetchStatus.Pending:
        print("FirebaseRemoteConfig Latest Fetch call still pending.");
        break;
}

} ```

Asked Sep 27 '21 00:09
avatar micsnz
micsnz

3 Answer:

Hi @micsnz,

Thanks for reporting this. So far, I haven't been able to replicate this issue with the information you provided. Could you provide a minimal, reproducible example of your project along with the steps taken before facing this issue? This way, we can identify what's causing this behavior.

1
Answered Aug 10 '21 at 14:50
avatar  of paulinon
paulinon

Hey @micsnz. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

1
Answered Aug 17 '21 at 01:00
avatar  of google-oss-bot
google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@micsnz if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

1
Answered Aug 23 '21 at 01:00
avatar  of google-oss-bot
google-oss-bot