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

Remove store #713

Merged
merged 1 commit into from
Jan 6, 2016
Merged

Remove store #713

merged 1 commit into from
Jan 6, 2016

Conversation

ejholmes
Copy link
Contributor

@ejholmes ejholmes commented Jan 3, 2016

This removes the internal store type, in favor of passing around a *gorm.DB instance. This is better, because it allows us to define better transactional boundaries, so we can wrap methods on the Empire struct in a transaction. This fixes that bug (thought we had an issue for it but couldn't find it) where deploying a docker image that didn't exist would still create an app within Empire, as well as some race conditions during release creation.

App: app,
Vars: make(Vars),
})
// Return an empty config.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This actually exposed a problem with using created_at to determine what is the current config for an app. There was a case where, when setting config on an app that didn't have any releases, 2 configs would get created at about the same time; 1 empty config and 1 with the update vars. Returning an empty config here fixes that race, but using an auto incremented id to order would probably be better.

if c == nil {
return p, s.Scheduler.Scale(ctx, release.AppID, string(p.Type), uint(quantity))
} else {
return p, s.releaser.Release(ctx, release)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This also fixes the issue where scaling with a new process size (e.g. emp scale web=2:256:20m) would require a new deployment to take effect.

@phobologic
Copy link
Contributor

👍

ejholmes added a commit that referenced this pull request Jan 6, 2016
@ejholmes ejholmes merged commit 3d0995d into master Jan 6, 2016
@ejholmes ejholmes deleted the transactions branch January 6, 2016 08:57
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

Successfully merging this pull request may close these issues.

2 participants