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

Don't update dependencies more than once #132

Merged
merged 3 commits into from
Jun 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix for #120
It's very ugly and there's a lot of design work that needs to do.
SeanTAllen committed Jun 7, 2020
commit d17741e81d26e4cbe448d95e9c8fa350a9eaf0b3
2 changes: 1 addition & 1 deletion corral/cmd/_test_cmd_update.pony
Original file line number Diff line number Diff line change
@@ -183,4 +183,4 @@ primitive _TestData

primitive _TestRepoCache
fun apply(auth: AmbientAuth): FilePath ? =>
FilePathS(auth,"_test_cmd_update_repo_cache")?
FilePath(auth,"_test_cmd_update_repo_cache")?
18 changes: 12 additions & 6 deletions corral/cmd/cmd_update.pony
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ actor _Updater

let deps_seen: Map[Locator, Dep] ref = deps_seen.create()
let deps_to_load: Map[Locator, Dep] ref = deps_to_load.create()
let deps_loading: Map[Locator, Dep] ref = deps_loading.create()
let dep_tags: Map[Locator, Array[String] val] ref = dep_tags.create()

let _vcs_builder: VCSBuilder
@@ -67,18 +68,20 @@ actor _Updater

fun ref load_queued_deps() =>
for dep in deps_to_load.values() do
try
load_dep(dep)?
else
ctx.uout.err("Error loading dep " + dep.name())
// It won't get a lock. How should we handle/report the error?
if not deps_loading.contains(dep.locator) then
try
load_dep(dep)?
else
ctx.uout.err("Error loading dep " + dep.name())
// It won't get a lock. How should we handle/report the error?
end
end
end
if deps_to_load.size() == 0 then
_results_receiver.cmd_completed()
end

fun load_dep(dep: Dep) ? =>
fun ref load_dep(dep: Dep) ? =>
let vcs = _vcs_builder(dep.vcs())?
let repo = RepoForDep(ctx, project, dep)?

@@ -109,6 +112,8 @@ actor _Updater
let sync_op = vcs.sync_op(sync_handler)
sync_op(repo)

deps_loading(locator) = dep

be load_transitive_dep(locator: Locator) =>
ctx.log.info("Loading transitive dep: " + locator.path())
try
@@ -127,6 +132,7 @@ actor _Updater
try
// If this remove fails, it just means another path got here first.
(_, let dep) = deps_to_load.remove(locator)?
deps_loading.remove(locator)?
ctx.log.fine("tags for " + dep.locator.string() + ": " + tags.size().string())
dep_tags(locator) = tags
end