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

chore(marketplace): notify sales when duration, minPricePerBytePerSecond or totalCollateral is updated #1148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

2-towns
Copy link
Contributor

@2-towns 2-towns commented Mar 7, 2025

Currently, when an availability is updated, sales is notified only when the freeSize increases.

This PR changes this behavior to notify sales when freeSize, duration, minPricePerBytePerSecond, or totalCollateral is increased. All those parameters are taken into consideration when trying to find an availability matching the slot.

@2-towns 2-towns marked this pull request as ready for review March 7, 2025 14:17
Copy link
Contributor

@emizzle emizzle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job 👏

Wdyt about OnAvailabilitySaved -> OnAvailabilityUpdated? Just a preference/opinion, not 100% needed.

Comment on lines +308 to +319
if OnAvailabilitySaved =? self.OnAvailabilitySaved:
# when chronos v4 is implemented, and OnAvailabilitySaved is annotated
# with async:(raises:[]), we can remove this try/catch as we know, with
# certainty, that nothing will be raised
try:
await onAvailabilityAdded(obj)
await OnAvailabilitySaved(obj)
except CancelledError as e:
raise e
except CatchableError as e:
# we don't have any insight into types of exceptions that
# `onAvailabilityAdded` can raise because it is caller-defined
warn "Unknown error during 'onAvailabilityAdded' callback", error = e.msg
# `OnAvailabilitySaved` can raise because it is caller-defined
warn "Unknown error during 'OnAvailabilitySaved' callback", error = e.msg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to annotate OnAvailableSaved with {.async: (raises: [].} and remove this try/except.

@emizzle emizzle changed the title chore(marletplace): notify sales when duration, minPricePerBytePerSecond or totalCollateral is updated chore(marketplace): notify sales when duration, minPricePerBytePerSecond or totalCollateral is updated Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants