public Task SaveAsync(Guid jobId, DataAcquirerJobConfig jobConfig)
 {
     if (_jobConfigs.TryAdd(jobId, jobConfig))
     {
         _eventTracker.TrackWarning(
             "AcquirerJobsAlreadyExists",
             "The job for acquirer already exists",
             new
         {
             jobId  = jobId,
             config = jobConfig
         });
     }
     return(Task.CompletedTask);
 }
Exemplo n.º 2
0
        public Task SaveAsync(Guid jobId, DataAcquirerJobConfig jobConfig)
        {
            var directory = new DirectoryInfo(_redditStorage.Directory);
            var fileName  = _redditStorage.FilePathPrefix + "_" + jobId;
            var file      = Path.Combine(directory.FullName, fileName);

            lock (_rwLock)
            {
                using var writer = new StreamWriter(file);
                var metadata = JsonConvert.SerializeObject(jobConfig);
                writer.WriteLine(metadata);
            }

            return(Task.CompletedTask);
        }