effect icon indicating copy to clipboard operation
effect copied to clipboard

From Discord: Logging Retry Attempts with Schedule in TypeScript

Open effect-bot opened this issue 2 years ago • 0 comments

Summary

In the above conversation, the user was trying to log retry attempts with a schedule in TypeScript. They wanted to log only when the effect runs as a result of a retry, not the initial run. They explored different approaches such as using tapInput and onDecision with the schedule, but encountered some limitations.

One suggestion was to log the error itself instead of logging the retry action. Another suggestion was to track executions with a ref or add a condition to the tapInput that checks for the type. It was also mentioned that logging the retry action is somewhat odd and may not be the best approach.

The user also expressed frustration with working with schedules and the lack of type inference for the input. It was suggested to explicitly specify the input type in the schedule to enable better type inference.

Additionally, the user mentioned the desire to apply different retry schedules to different errors. It was suggested to define multiple schedules and use a union of them to handle different error types.

Key takeaways:

  • Logging retry attempts with a schedule can be achieved by logging the error itself or tracking executions with a ref.
  • Type inference for the input in schedules can be improved by explicitly specifying the input type.
  • Applying different retry schedules to different errors can be done by defining multiple schedules and using a union of them.

Discord thread

https://discord.com/channels/795981131316985866/1182013392911880292

effect-bot avatar Dec 06 '23 19:12 effect-bot