-
Notifications
You must be signed in to change notification settings - Fork 705
[Movey] Call Movey API to increase download count #318
[Movey] Call Movey API to increase download count #318
Conversation
d5140e3 to
ee77028
Compare
awelc
left a comment
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 have to say I am still confused what this PR does... I though this addition is to avoid increasing GitHub's download count when uploading the repo content to Movey (so that the counter value is not artificially inflated by multiple uploads). Looking at the code, though, it seems like we are actually incrementing the counter (which would otherwise not be incremented as part of the upload?), so I am not even sure if I got the notion of the counter right... Could you please provide some additional explanation?
e6306d8 to
d00aef5
Compare
For this PR it does increase the counter but it's the download counter whenever a move package in move.toml is resolved by resolution graph. A new thread will be spun to send a request to Movey whenever |
|
Adding @tnowacki as a reviewer here as this PR involves a change to package resolver and I am not sure if spawning a thread and calling to Movey on (seemingly) each dependency check (for already downloaded dependencies) during resolution graph building is the right strategy here. |
I think you misunderstood the logic, calling to Movey only happens when |
…o `increase_movey_download_count`
…_repo`, rename `skip_movey_flag` to `skip_movey`
- change `init_mock_server` to `mock_movey_count_request_with_response_status_code` - change `wait` to `test_thread_wait`
d00aef5 to
4289293
Compare
awelc
left a comment
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.
Thank you for the additional explanation! It looks like the call to Movey indeed only happens right where download_and_update_if_remote is called, which makes me wonder why you did not include it as part of download_and_update_if_remote function's definition. You even have the right checks there already:
if let Some(git_info) = &dep.git_info {
if !git_info.download_to.exists() {
This would make the logic here more explicit right off the bat and I suggest you do it unless there is a good reason not to.
I am still confused by what you are trying to accomplish here. You call into Movey when resolving dependencies during a build process and a developer may be building a package that has nothing to do with Movey. I don't understand why you want to call to Movey in such cases, and even more importantly, even if this was the case, this should be presented as opt-in to the user (they choose to increase the Movey download count) rather than opt-out (they have to choose not to increase the count).
Additionally, the --skip-movey flag is presented in the description of this PR as an addition to the move movey-upload, but it's part of build config and (I think) move movey-upload does not even do any building. Please clarify.
| } | ||
| } | ||
|
|
||
| Self::download_and_update_if_remote(*dep_name, dep)?; |
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 feel like it would make more sense to include this logic in download_and_update_if_remote. Is there some reason not to?
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 was our solution originally, however, we decided to move the call to update_download_count outside of the download_and_update_if_remote. We do this in order to write tests and separate Movey logic and download_and_update_if_remote logic as much as possible.
We can move update_download_count logic inside download_and_update_if_remote but doing that would complicate the testing logic.
| if skip_movey { | ||
| return; | ||
| } |
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 feel like it is cleaner to move this to outside of this function. Feels awkward to have a bool flag that is just immediately used to return or not
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 can be resolved depending on the solution of #318 (comment)
| if let Some(git_info) = &dep.git_info { | ||
| if !git_info.download_to.exists() { |
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.
Consider also
let already_downloaded = dep.git_info.map(|gi| gi.download_to.exists()).unwrap_or(true);
if !already_downloaded {
Self::increase_movey_download_count( ... )
}
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 can be resolved depending on the solution of #318 (comment)
|
|
||
| fn test_thread_wait(wait_time: Option<u64>) { | ||
| // make sure the spawn thread has enough time to run | ||
| let thread_sleep_time = time::Duration::from_millis(wait_time.unwrap_or(20)); |
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.
nit maybe move 20 to a constant
|
In the PR description, you have
I think this should be |
|
@awelc @tnowacki There are multiple reasons why we made this explicitly opt-in:
|
Yes, It should be |
tnowacki
left a comment
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.
After discussing it, we have decided it would be best if movey was it's own custom source provider. These were recently added, see #318
This way, movey packages will be resolved with their own syntax, something similar to CustomPackage = { node: "movey", address: "0x1", package: "custom-package" }
|
Movey is a centralized registry for Move packages but not an independent repository ("its own custom source provider"). Among the reasons for not being a repository are (1) developers likely prefer Github and this may hamper adoption, and (2) there would be a lot more engineering involved and this would take time and be redundant ("reinventing the wheel"), (3) this would take focus away from features that add value not found elsewhere. Perhaps what is being suggested here is that Movey should provide a pointer to existing on-chain locations for packages. And indeed, we do have that on our roadmap. At first these links might be informational (no guarantees) later they can be validated and certified by us. @tnowacki perhaps we are missing something. What is the compelling advantage? |
|
After further discussions about package dependencies resolving, we have released a new tool MoveyCLI. This PR is no longer needed. Closing. |
Motivation
According to Sam, we moved the call to Movey into this pull request.
How to use it
As usual any build action that involves cloning from github will also calls to Movey to increase download count metre.
Note: you could use the flag
--skip-moveyto skip this call, although it has negligible impact on build performance.Example:
move build --skip-moveyHave you read the Contributing Guidelines on pull requests?
Yes
Test Plan
cargo test --package move-package --lib increase_movey_download_count