Scheduler and also Main file to call server and scheduler

This commit is contained in:
Guntis Smaukstelis
2023-05-14 15:48:52 +03:00
parent ea19ae27f8
commit 6ca1f4a13a
6 changed files with 100 additions and 9 deletions
+11
View File
@@ -48,6 +48,17 @@ object FetchService {
}
}
def fetchSingleFile(fileName: String): IO[(String, String)] = {
println("start fetching")
fetchFiles(List(fileName)).flatMap { results =>
results.headOption match {
case Some(Right(result)) => IO.pure(result)
case Some(Left(err)) => IO.raiseError(err)
case None => IO.raiseError(new Exception("No file fetched"))
}
}
}
def fetchInRange(from: LocalDateTime, to: LocalDateTime): IO[List[Either[Throwable, (String, String)]]] = {
val fileNames = FileNameService.generate(from, to)
fetchFiles(fileNames)