-
Notifications
You must be signed in to change notification settings - Fork 47.1k
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
Flip expiration times #13912
Flip expiration times #13912
Conversation
These all correspond to millisecond timestamps... and now they’re reversed? If our model weren’t so tied to a timeline and these were merely relative priorities, I would like this. But since they represent deadlines I find it confusing. |
ReactDOM: size: -0.2%, gzip: -0.2% Details of bundled changes.Comparing: bf9fadf...29e1b1f react-dom
react-art
react-test-renderer
react-reconciler
react-native-renderer
scheduler
Generated by 🚫 dangerJS |
You win some, you lose some. Just pretend you're looking in a mirror. |
Want me to make them all negative? 🙄 min 31-bit int - Sync Then 0 is in the right place and it goes in the right direction… |
I think we can find a mental model where this makes sense. E.g. a count down until the app stops working (NoWork). |
I’m cool with this if we rename the field, too. Like |
(childChildExpirationTime !== NoWork && | ||
childChildExpirationTime < newChildExpirationTime) | ||
) { | ||
if (childChildExpirationTime > newChildExpirationTime) { | ||
newChildExpirationTime = childChildExpirationTime; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😢
I kinda like the negative clock (that becomes less negative over time) actually… what about you two? |
Nah. Negative is weird. That's not Rust/WASM/et al friendly since we'd want the unsigned form there. |
If we didn’t already have something called “priority” I would say let’s rename it to that and merge your PR as is. I don’t like the “expirationTime” naming regardless because it only acts like an expiration time when we schedule the callback with Scheduler. Everywhere else it acts like a relative priority. Precedence? Urgency? Rank? (I’m just reading the thesaurus) |
"Threshold" maybe. |
Importance? |
Note that we also plan to add another public priority API which is not related to time (the priority of fallbacks returning to their unsuspended state). |
Urgency? |
We're hopeless. |
Oh I missed @acdlite already suggested urgency. |
@sebastian yeah and I also don’t think we understand the relationship between the two concepts yet, either. |
restlessness |
Agree, we use the priority name before but then use expirationTime to abstract too many things for processing starvation and competition better. But just from a developer perspective, the expirationTime is confused and hard to understand(lower means higher, higher means lower), and when you compare it to some names like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can rename the fields later once we think of something good
``` codemod --accept-all -d packages -i '((?:expiration|suspended|pending|current|remaining|absolute|renderer|pinged|completed)time(?:(?:before|after)commit)? )<' '\1dnkvjchbdddtngeurvlbvbktrilldeeu' codemod --accept-all -d packages -i '((?:expiration|suspended|pending|current|remaining|absolute|renderer|pinged|completed)time(?:(?:before|after)commit)? )>' '\1<' codemod --accept-all -d packages -i '((?:expiration|suspended|pending|current|remaining|absolute|renderer|pinged|completed)time(?:(?:before|after)commit)? )dnkvjchbdddtngeurvlbvbktrilldeeu' '\1>' git checkout packages/scheduler/src/Scheduler.js ```
Ran these, then prettier, then these again, then prettier again. ``` codemod --accept-all -d packages -m '\(\s*([a-zA-Z.]+) === NoWork\s*\|\|\s*\1 (<=?) ([a-zA-Z.]+)\s*\)' '(\1 \2 \3)' codemod --accept-all -d packages -m '\(\s*([a-zA-Z.]+) === NoWork\s*\|\|\s*([a-zA-Z.]+) (>=?) \1\s*\)' '(\2 \3 \1)' codemod --accept-all -d packages -m '(?<![.\w])([a-zA-Z.]+) !== NoWork\s*&&\s*\1 (>) ([a-zA-Z.]+)' '\1 \2 \3' codemod --accept-all -d packages -m '(?<![.\w])([a-zA-Z.]+) !== NoWork\s*&&\s*([a-zA-Z.]+) (<) \1' '\2 \3 \1' codemod --accept-all -d packages -m '(?<![.\w])([a-zA-Z.]+) === NoWork\s*\|\|\s*\1 (<=?) ([a-zA-Z.]+)\s*\?\s' '\1 \2 \3 ? ' codemod --accept-all -d packages -m '(?<![.\w])([a-zA-Z.]+) === NoWork\s*\|\|\s*([a-zA-Z.]+) (>=?) \1\s*\?\s' '\2 \3 \1 ? ' ```
See facebook#13912 commit messages for how this was done.
Now:
0 - NoWork
1 - Never
...
big - low pri things
even bigger - hi pri things
max 31-bit int - Sync
Per @sebmarkbage in #13904.