为什么 Google Firestore C# SDK 在第一次编写时非常慢?
Why Google Firestore C# SDK is incredibly slow at first write?
我正在使用 Google Firestore C# SDK,第一次写入操作非常慢(超过 50 秒)。
你能帮我弄清楚发生了什么吗?
代码:
Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", @"<path_to_my_auth.json>");
FirestoreDb db = FirestoreDb.CreateAsync("mydatabase").GetAwaiter().GetResult();
DocumentReference docRef = db.Collection("scopes/6160673f-214f-46e2-959d-15ffc51655fc/audit").Document();
Dictionary<string, string> data = new Dictionary<string, string>();
data["abc"] = "123";
docRef.CreateAsync(data).GetAwaiter().GetResult();
我刚刚弄清楚发生了什么:DNS 8.8.8.8 导致了延迟。将其更改为任何其他,缓慢消失。
如果我尝试使用 Google.Apis.Auth C# SDK 生成访问令牌,也会出现同样的情况。
我正在使用 Google Firestore C# SDK,第一次写入操作非常慢(超过 50 秒)。
你能帮我弄清楚发生了什么吗?
代码:
Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", @"<path_to_my_auth.json>");
FirestoreDb db = FirestoreDb.CreateAsync("mydatabase").GetAwaiter().GetResult();
DocumentReference docRef = db.Collection("scopes/6160673f-214f-46e2-959d-15ffc51655fc/audit").Document();
Dictionary<string, string> data = new Dictionary<string, string>();
data["abc"] = "123";
docRef.CreateAsync(data).GetAwaiter().GetResult();
我刚刚弄清楚发生了什么:DNS 8.8.8.8 导致了延迟。将其更改为任何其他,缓慢消失。
如果我尝试使用 Google.Apis.Auth C# SDK 生成访问令牌,也会出现同样的情况。