Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorbobaylor committed May 1, 2023
1 parent 1e94ea5 commit ea2cf1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion TrailerDownloader/Repositories/ITrailerRepository.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using TrailerDownloader.Models;

namespace TrailerDownloader.Repositories
{
public interface ITrailerRepository
{
void GetAllMoviesInfo();
Task GetAllMoviesInfo();
void DownloadAllTrailers(IEnumerable<Movie> movieList);
bool DeleteAllTrailers(IEnumerable<Movie> movieList);
}
Expand Down
8 changes: 4 additions & 4 deletions TrailerDownloader/SignalRHubs/MovieHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public MovieHub(IHttpClientFactory httpClientFactory, ILogger<MovieHub> logger,
}
}

public async void GetAllMoviesInfo()
public async Task GetAllMoviesInfo()
{
GetMovieDirectories(_mainMovieDirectory);
List<Task<Movie>> taskList = new List<Task<Movie>>();
Expand All @@ -65,7 +65,7 @@ public async void GetAllMoviesInfo()
if (_movieDictionary.TryGetValue(movie.Title, out Movie dictionaryMovie))
{
dictionaryMovie.TrailerExists = movie.TrailerExists;
await _hubContext.Clients.All.SendAsync("getAllMoviesInfo", dictionaryMovie);
await _hubContext.Clients.All.SendAsync("getAllMoviesInfo", dictionaryMovie).ConfigureAwait(false);
}
else
{
Expand All @@ -76,7 +76,7 @@ public async void GetAllMoviesInfo()

if (taskList.Count > 0)
{
_ = await Task.WhenAll(taskList);
_ = await Task.WhenAll(taskList).ConfigureAwait(false);
}

_movieDictionary.ToList().ForEach(mov =>
Expand All @@ -87,7 +87,7 @@ public async void GetAllMoviesInfo()
}
});

await _hubContext.Clients.All.SendAsync("completedAllMoviesInfo", _movieDictionary.Count);
await _hubContext.Clients.All.SendAsync("completedAllMoviesInfo", _movieDictionary.Count).ConfigureAwait(false);
}

private void GetMovieDirectories(string directoryPath)
Expand Down

0 comments on commit ea2cf1e

Please sign in to comment.