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

imported? on Provider/Target Image could check status locally #78

Open
n1zyy opened this issue Dec 13, 2012 · 2 comments
Open

imported? on Provider/Target Image could check status locally #78

n1zyy opened this issue Dec 13, 2012 · 2 comments

Comments

@n1zyy
Copy link

n1zyy commented Dec 13, 2012

When an image is imported, it looks like the ProviderImage and TargetImage both have their status set to "IMPORTED". But right now, calling imported? launches a chain of queries that ultimately checks whether BaseImage is imported or not, even though those methods could check if status == 'IMPORTED' and avoid the lookup.

I was going to send a quick pull request for this, but there's this wrinkle:

  after_create :create_import, :if => :imported?
@n1zyy
Copy link
Author

n1zyy commented Dec 13, 2012

(This, of course, is a minor RFE, versus any sort of serious problem. But it can save a couple database queries where its parents aren't already in cache.)

@mtaylor
Copy link

mtaylor commented Dec 14, 2012

Good catch there Matty.

IIRC the TargetImage gets it's status from the BaseImage so we'll at least need to keep this for TargetImage. But ProviderImage should look up the TargetImage status rather than having to do a load of joins to get the BaseImage.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants