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

Use Go context to abort gracefully mirror updates #683

Merged
merged 2 commits into from
Nov 30, 2017
Merged

Conversation

smira
Copy link
Contributor

@smira smira commented Nov 29, 2017

There are two fixes here:

  1. Abort package download immediately as ^C is pressed.
  2. Import all the already downloaded files into package pool,
    so that next time mirror is updated, aptly won't download them
    once again.

Fixes #545

Requirements

Checklist

  • unit-test added (if change is algorithm)
  • functional test added/updated (if change is functional)
  • man page updated (if applicable)
  • bash completion updated (if applicable)
  • documentation updated
  • author name in AUTHORS

There are two fixes here:

1. Abort package download immediately as ^C is pressed.
2. Import all the already downloaded files into package pool,
so that next time mirror is updated, aptly won't download them
once again.
@@ -30,6 +32,8 @@ import (
type AptlyContext struct {
sync.Mutex

ctx gocontext.Context
Copy link
Contributor

Choose a reason for hiding this comment

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

I was just browsing through this change. Thanks for working on this issue.

One question I have is though wouldn't it be better and more readable when go context is an embedded type of Aptly context (like sync.Mutex)? This way aptly and go context can be used interchangeably.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting idea, I never thought about it to be honest. I'll try it, thanks!

@smira smira merged commit 9cb2a30 into master Nov 30, 2017
@smira smira deleted the 545-download-contxt branch November 30, 2017 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aptly should clean up after itself on interrupts
2 participants