Skip to content

Commit

Permalink
Fixed FirstMatch and Matches publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
Raghav Ahuja committed Apr 18, 2020
1 parent c95c462 commit 8a4c6fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/PublisherKit/Publishers/Matches/First Match.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ extension Publishers.FirstMatch {
guard status == .awaiting else { lock.unlock(); return }
status = .subscribed(to: subscription)
lock.unlock()

downstream?.receive(subscription: self)
}

func receive(_ input: String) -> Subscribers.Demand {
Expand Down Expand Up @@ -114,6 +116,7 @@ extension Publishers.FirstMatch {
guard status.isSubscribed else { lock.unlock(); return }
status = .terminated
lock.unlock()

downstream?.receive(completion: completion.eraseError())
}

Expand Down
3 changes: 3 additions & 0 deletions Sources/PublisherKit/Publishers/Matches/Matches.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ extension Publishers.Matches {
guard status == .awaiting else { lock.unlock(); return }
status = .subscribed(to: subscription)
lock.unlock()

downstream?.receive(subscription: self)
}

func receive(_ input: String) -> Subscribers.Demand {
Expand Down Expand Up @@ -114,6 +116,7 @@ extension Publishers.Matches {
guard status.isSubscribed else { lock.unlock(); return }
status = .terminated
lock.unlock()

downstream?.receive(completion: completion.eraseError())
}

Expand Down

0 comments on commit 8a4c6fa

Please sign in to comment.