1616
1717package org .scalasteward .core .nurture
1818
19- import cats .effect . Sync
19+ import cats .Applicative
2020import cats .implicits ._
2121import eu .timepit .refined .types .numeric .PosInt
22+ import fs2 .Stream
2223import io .chrisdavenport .log4cats .Logger
2324import org .scalasteward .core .application .Config
2425import org .scalasteward .core .coursier .CoursierAlg
@@ -30,7 +31,7 @@ import org.scalasteward.core.repocache.RepoCacheRepository
3031import org .scalasteward .core .repoconfig .{PullRequestUpdateStrategy , RepoConfigAlg }
3132import org .scalasteward .core .scalafix .MigrationAlg
3233import org .scalasteward .core .util .logger .LoggerOps
33- import org .scalasteward .core .util .{DateTimeAlg , HttpExistenceClient }
34+ import org .scalasteward .core .util .{BracketThrowable , DateTimeAlg , HttpExistenceClient }
3435import org .scalasteward .core .vcs .data .{NewPullRequestData , Repo }
3536import org .scalasteward .core .vcs .{VCSApiAlg , VCSExtraAlg , VCSRepoAlg }
3637import org .scalasteward .core .{git , util , vcs }
@@ -50,15 +51,16 @@ final class NurtureAlg[F[_]](implicit
5051 migrationAlg : MigrationAlg ,
5152 pullRequestRepository : PullRequestRepository [F ],
5253 repoCacheRepository : RepoCacheRepository [F ],
53- F : Sync [F ]
54+ streamCompiler : Stream .Compiler [F , F ],
55+ F : BracketThrowable [F ]
5456) {
5557 def nurture (repo : Repo , updates : List [Update .Single ]): F [Either [Throwable , Unit ]] = {
5658 val label = s " Nurture ${repo.show}"
5759 logger.infoTotalTime(label) {
5860 logger.attemptLog(util.string.lineLeftRight(label)) {
59- F .bracket( cloneAndSync(repo)) { case (fork, baseBranch) =>
61+ cloneAndSync(repo).flatMap { case (fork, baseBranch) =>
6062 updateDependencies(repo, fork, baseBranch, updates)
61- }(_ => gitAlg.removeClone(repo))
63+ }
6264 }
6365 }
6466 }
@@ -232,15 +234,15 @@ final class NurtureAlg[F[_]](implicit
232234}
233235
234236object NurtureAlg {
235- def processUpdates [F [_]: Sync ](
237+ def processUpdates [F [_]](
236238 updates : List [Update ],
237239 updateF : Update => F [ProcessResult ],
238240 updatesLimit : Option [PosInt ]
239- ): F [Unit ] =
241+ )( implicit streamCompiler : Stream . Compiler [ F , F ], F : Applicative [ F ]) : F [Unit ] =
240242 updatesLimit match {
241243 case None => updates.traverse_(updateF)
242244 case Some (limit) =>
243- fs2. Stream
245+ Stream
244246 .emits(updates)
245247 .evalMap(updateF)
246248 .through(util.takeUntil(limit.value) {
0 commit comments