Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add conversion to FiniteDuration to zio.duration #8797

Closed
domdorn opened this issue Apr 26, 2024 · 11 comments · Fixed by #8962
Closed

add conversion to FiniteDuration to zio.duration #8797

domdorn opened this issue Apr 26, 2024 · 11 comments · Fixed by #8962

Comments

@domdorn
Copy link
Contributor

domdorn commented Apr 26, 2024

Unfortunatelly we still have a lot of akka in our codebase.
akka always requires scala.concurrent.duration.FiniteDuration instances, however I always have zio._ imported.
There's already a .asScala conversion, however that one gives me just the supertype scala.concurrent.duration.Duration when I need the subtype.

could we maybe have a .asScalaFinite or .asScalaFiniteUnsafe that would return a FiniteDuration for everything that is not infinity?

https://github.com/zio/zio/blob/series/2.x/core/shared/src/main/scala/zio/Duration.scala#L176-L181

Thanks!

@jdegoes
Copy link
Member

jdegoes commented May 8, 2024

I think asScala could be made to return FiniteDuration always, which might be the better fix.

@jdegoes
Copy link
Member

jdegoes commented May 8, 2024

/bounty $50

Copy link

algora-pbc bot commented May 8, 2024

## 💎 $50 bounty • ZIO

### Steps to solve:
1. Start working: Comment /attempt #8797 with your implementation plan
2. Submit work: Create a pull request including /claim #8797 in the PR body to claim the bounty
3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @asr2003 Jun 22, 2024, 11:25:00 AM #8962
🟢 @Adriani277 #8960

@NavidJalali
Copy link
Contributor

I think asScala could be made to return FiniteDuration always, which might be the better fix.

Isnt that a regression? I mean what would it return for the infinite case?

@jdegoes
Copy link
Member

jdegoes commented May 12, 2024

@NavidJalali The thing is, there is no infinite case. It's faked. It used to exist back when we used Scala duration but Duration.Inf was ported over to mean "big finite" when we adopted java.time structures.

(Unless I'm missing something...)

Copy link

algora-pbc bot commented Jun 21, 2024

💡 @Adriani277 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

@asr2003
Copy link
Contributor

asr2003 commented Jun 22, 2024

/attempt #8797

Copy link

algora-pbc bot commented Jun 23, 2024

🎉🎈 @Adriani277 has been awarded $50! 🎈🎊

Copy link

algora-pbc bot commented Jun 23, 2024

💡 @asr2003 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Jun 24, 2024

@asr2003: You've been awarded a $50 bounty by ZIO! 👉 Complete your Algora onboarding to collect the bounty.

ghostdogpr added a commit to ghostdogpr/scalaz-zio that referenced this issue Jun 25, 2024
Copy link

algora-pbc bot commented Jun 30, 2024

🎉🎈 @asr2003 has been awarded $50! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants