-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Clarify use of sync. Closes #2298 #2303
Clarify use of sync. Closes #2298 #2303
Conversation
group-income Run #3144
Run Properties:
|
Project |
group-income
|
Branch Review |
feature/2298-fix-confused-and-updated-sync-situation
|
Run status |
Passed #3144
|
Run duration | 09m 21s |
Commit |
b60a61c82f ℹ️: Merge d05123d8b40f0052ec3ecd9e7aa62a43ae9c7539 into 2e6183c6a4cf47b9719b35a30402...
|
Committer | Ricardo Iván Vieitez Parra |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
10
|
Skipped |
0
|
Passing |
111
|
View all changes introduced in this branch ↗︎ |
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.
Great work @corrideat! Some questions
f8bb009
to
f992d55
Compare
Updated! |
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.
Since the build is failing and we need to re-run it anyway, can you push a commit with an elaborated comment?
a858784
to
d71ad21
Compare
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.
Concern:
const listener = () => { reset = true } | ||
this.ephemeral.ondestroy = () => { | ||
destroyed = true | ||
sbp('okTurtle.events/off', CHELONIA_RESET, listener) | ||
syncPromise.finally(() => { | ||
if (reset) return | ||
sbp('chelonia/contract/release', this.ephemeral.groupIdWhenMounted, { ephemeral: true }).catch(e => { | ||
console.error('[PendingApproval.vue]: Error releasing contract', e) | ||
}) | ||
}) | ||
} | ||
sbp('okTurtle.events/on', CHELONIA_RESET, listener) | ||
}, | ||
beforeDestroy () { | ||
this.ephemeral.ondestroy?.() |
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.
What is all of this new logic and why has it been added here?
I'm not sure this is a good idea... did you test this with multiple groups? It's possible that beforeDestroy
could be called as a result of the group switcher switching to a different group. If that happens it would break the joining attempt on the new group that we're trying to join.
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.
This isn't really new logic, rather redefining the old logic that called /sync
, which is unsafe to call.
It's possible that beforeDestroy could be called as a result of the group switcher switching to a different group
I don't see how that'd break anything. The onDestroy
is there to call release
, which is the correct thing to do after calling retain
. If the view is destroyed, there's no point in keeping the group around (if it shouldn't be released, the reference count should indicate that). Note that before this only called sync
and it also didn't affect the reference count.
did you test this with multiple groups?
No, I'm not sure how that'd be done as joining a group would open a new URL?
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.
No, I'm not sure how that'd be done as joining a group would open a new URL?
You'd create and join group1 as u1. Then u2 (in a separate container tab or browser) would send you an invite link to group2, but before u1 visits it, u2 would log out. Then u1 visits the link to join u2's group2 and get stuck on this pending page. Then they'd switch back to their own group. Then u2 would log back in.
I don't see how that'd break anything. The onDestroy is there to call release, which is the correct thing to do after calling retain. If the view is destroyed, there's no point in keeping the group around (if it shouldn't be released, the reference count should indicate that). Note that before this only called sync and it also didn't affect the reference count.
I see. Could you add a comment here as well then to explain where the "real" (persistent) retain happens on this group and why we're calling ephemeral retain here instead of sync
?
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.
You'd create and join group1 as u1. [...]
I did this and nothing broke, as expected, since this is merely a UI concern.
Could you add a comment here as well then
Done. Also added a comment to the effect that vue
files should not be managing references.
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.
Approved! Fantastic work @corrideat!
Fix #2298