示例#1
0
        public async Task PopulateForBundle(string bundleId)
        {
            var dict = new ConcurrentDictionary <string, DumpMetainfo>();

            foreach (var dumpInfo in await storage.ReadDumpMetainfoForBundle(bundleId))
            {
                if (dumpInfo == null)
                {
                    Console.Error.WriteLine($"ReadDumpMetainfoForBundle returned a null entry for bundleId '{bundleId}'");
                    continue;
                }
                dict[dumpInfo.DumpId] = dumpInfo;
            }
            dumps.TryAdd(bundleId, dict);
        }
示例#2
0
        /// <summary>
        /// Older storage did not have metainfo files. We need to read full results, create new metainfo file and store it.
        /// </summary>
        /// <param name="bundleId"></param>
        private async Task CreateBundleMetainfoForCompat(string bundleId)
        {
            var metainfo = new BundleMetainfo()
            {
                BundleId = bundleId
            };
            // use storage directly, not repo. repo might not be initialized yet
            // back then, every dump had the same information encoded. take the first dump and use it from there.

            var dumps = await dumpStorage.ReadDumpMetainfoForBundle(bundleId);

            // loop through all dumps and hope to find a good one.
            foreach (var dump in dumps)
            {
                if (dump != null)
                {
                    metainfo.Created  = dump.Created;
                    metainfo.Finished = dump.Created;                     // can't do better.
                    metainfo.Status   = BundleStatus.Finished;
                    var fullresult = await dumpStorage.ReadResults(dump.Id);

                    if (fullresult != null)
                    {
                        if (!string.IsNullOrEmpty(fullresult.AnalysisInfo.JiraIssue))
                        {
                            metainfo.CustomProperties["ref"] = fullresult.AnalysisInfo.JiraIssue;
                        }
                        if (!string.IsNullOrEmpty(fullresult.AnalysisInfo.FriendlyName))
                        {
                            metainfo.CustomProperties["note"] = fullresult.AnalysisInfo.FriendlyName;
                        }
                        break;
                    }
                }
            }
            WriteMetainfoFile(metainfo, pathHelper.GetBundleMetadataPath(bundleId));
        }