diff --git a/README.md b/README.md
new file mode 100644
index 0000000..fdcb653
--- /dev/null
+++ b/README.md
@@ -0,0 +1,30 @@
+# Replay Browser
+
+This is the repository for a replay browser for Space Station 14. The replay browser downloads replays from the provided paths, parses them, and then finally inserts it into the provided DB.
+You can view the deployed website [here](https://replay.unstablefoundation.de/)
+
+## Setup
+
+Setting up a dev env is simple.
+These instructions assume that you have a postgres database set up.
+
+1. Clone the repository.
+2. Set up the appsettings file.
+ Create a file named `appsettings.Secret.json` in the server project.
+ This is where you can put your connection string for the postgres DB.
+3. Run both the server and client using `dotnet`. The server will now download a lot of replays. This will take some time and it will use about 50 Mbps. You can keep using your computer during this time.
+
+## Screenshots
+
+ View
+
+ 
+
+
+
+
+
+
+
+
+
diff --git a/Server/ReplayParser.cs b/Server/ReplayParser.cs
index 5f235bf..4f6f409 100644
--- a/Server/ReplayParser.cs
+++ b/Server/ReplayParser.cs
@@ -51,14 +51,12 @@ public static Task AddParsedReplayToDb(string replay)
public static async Task ConsumeQueue(CancellationToken token)
{
- while (!token.IsCancellationRequested)
+ // Consume the queue.
+ while (Queue.Count > 0)
{
- // Consume the queue.
- while (Queue.Count > 0)
- {
- var timeoutToken = new CancellationTokenSource(10000);
- var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, timeoutToken.Token);
- var startTime = DateTime.Now;
+ var timeoutToken = new CancellationTokenSource(10000);
+ var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, timeoutToken.Token);
+ var startTime = DateTime.Now;
// Since replays are like 200mb long, we want to parrallelize this.
var tasks = new List();
@@ -105,38 +103,35 @@ public static async Task ConsumeQueue(CancellationToken token)
parsedReplay.Date = date.ToUniversalTime();
}
- // One more check to see if it's already in the database.
- if (await IsReplayParsed(replay))
- {
- return;
- }
-
- await AddReplayToDb(parsedReplay);
- await AddParsedReplayToDb(replay);
- Log.Information("Parsed " + replay);
- }
- catch (Exception e)
+ // One more check to see if it's already in the database.
+ if (await IsReplayParsed(replay))
{
- Log.Error(e, "Error while parsing " + replay);
+ return;
}
- }, tokenSource.Token));
- }
+
+ await AddReplayToDb(parsedReplay);
+ await AddParsedReplayToDb(replay);
+ Log.Information("Parsed " + replay);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e, "Error while parsing " + replay);
+ }
+ }, tokenSource.Token));
+ }
- // If the download takes too long, cancel it.
- // 10 minutes should be enough
- await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(600000, token));
- await timeoutToken.CancelAsync();
- // Cancel the timeout token, so the background tasks cancel as well.
+ // If the download takes too long, cancel it.
+ // 10 minutes should be enough
+ await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(600000, token));
+ await timeoutToken.CancelAsync();
+ // Cancel the timeout token, so the background tasks cancel as well.
- // If we timed out, log a warning.
- if (DateTime.Now - startTime > TimeSpan.FromMinutes(10))
- {
- Log.Warning("Parsing took too long for " + string.Join(", ", tasks.Select(x => x.Id)));
- }
+ // If we timed out, log a warning.
+ if (DateTime.Now - startTime > TimeSpan.FromMinutes(10))
+ {
+ Log.Warning("Parsing took too long for " + string.Join(", ", tasks.Select(x => x.Id)));
}
-
- await Task.Delay(5000, token);
- }
+ }
}
///
@@ -341,4 +336,4 @@ public static List SearchReplays(SearchMode mode, string query, ReplayDb
throw new NotImplementedException();
}
}
-}
\ No newline at end of file
+}