Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

removed unnecessary Effect.fail call #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/cluster-node/src/PodsRpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function podsRpc<R>(
Effect.catchAllDefect((e) =>
pipe(
Effect.logError(e),
Effect.zipRight(Effect.fail(new ShardingException.PodUnavailableException({ podAddress })))
Effect.zipRight(new ShardingException.PodUnavailableException({ podAddress }))
)
)
)
Expand All @@ -51,7 +51,7 @@ export function podsRpc<R>(
Effect.catchAllDefect((e) =>
pipe(
Effect.logError(e),
Effect.zipRight(Effect.fail(new ShardingException.PodUnavailableException({ podAddress })))
Effect.zipRight(new ShardingException.PodUnavailableException({ podAddress }))
)
)
)
Expand All @@ -64,7 +64,7 @@ export function podsRpc<R>(
pipe(
Effect.logError(e),
Effect.zipRight(
Effect.fail(new ShardingException.PodUnavailableException({ podAddress }))
new ShardingException.PodUnavailableException({ podAddress })
)
)
)
Expand All @@ -77,7 +77,7 @@ export function podsRpc<R>(
Effect.catchAllDefect((e) =>
pipe(
Effect.logError(e),
Effect.zipRight(Effect.fail(new ShardingException.PodUnavailableException({ podAddress })))
Effect.zipRight(new ShardingException.PodUnavailableException({ podAddress }))
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion packages/cluster/src/internal/entityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export function make<Msg extends Message.Message.Any, R>(
Effect.flatMap(sharding.isShuttingDown, (isGoingDown) => {
if (isGoingDown) {
// don't start any fiber while sharding is shutting down
return Effect.fail(new ShardingException.EntityNotManagedByThisPodException({ recipientAddress }))
return new ShardingException.EntityNotManagedByThisPodException({ recipientAddress })
} else {
// offer doesn't exist, create a new one
return Effect.gen(function*(_) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cluster/src/internal/shardManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function make(
) {
return RefSynchronized.updateEffect(stateRef, (state) => {
if (Option.isSome(pod) && !HashMap.has(state.pods, pod.value)) {
return Effect.fail(new ShardingException.PodNoLongerRegisteredException({ podAddress: pod.value }))
return new ShardingException.PodNoLongerRegisteredException({ podAddress: pod.value })
}
return Effect.succeed({
...state,
Expand Down
8 changes: 4 additions & 4 deletions packages/cluster/src/internal/sharding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function make(
Effect.flatMap((_) =>
Unify.unify(Option.match(_, {
onNone: () =>
Effect.fail(new ShardingException.EntityTypeNotRegisteredException({ entityType, podAddress: address })),
new ShardingException.EntityTypeNotRegisteredException({ entityType, podAddress: address }),
onSome: (entityManager) => Effect.succeed(entityManager as EntityManager.EntityManager)
}))
)
Expand Down Expand Up @@ -508,7 +508,7 @@ function make(
Unify.unify(pipe(
state,
MessageState.match({
onAcknowledged: () => Effect.fail(new ShardingException.NoResultInProcessedMessageStateException()),
onAcknowledged: () => new ShardingException.NoResultInProcessedMessageStateException(),
onProcessed: (state) => Effect.succeed(state.result)
})
))
Expand Down Expand Up @@ -539,7 +539,7 @@ function make(
Effect.flatMap((pod) =>
Option.isSome(pod)
? Effect.succeed(pod.value)
: Effect.fail(new ShardingException.EntityNotManagedByThisPodException({ recipientAddress }))
: new ShardingException.EntityNotManagedByThisPodException({ recipientAddress })
),
Effect.flatMap((pod) =>
sendMessageToPodWithoutRetries(
Expand Down Expand Up @@ -638,7 +638,7 @@ function make(
state,
MessageState.match({
onAcknowledged: () =>
Effect.fail(new ShardingException.NoResultInProcessedMessageStateException()),
new ShardingException.NoResultInProcessedMessageStateException(),
onProcessed: (state) => Effect.succeed(state.result)
})
))
Expand Down