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

Decrease the num_stars when deleting a repo #11954

Merged
merged 24 commits into from
Jul 7, 2020

Conversation

a1012112796
Copy link
Member

@a1012112796 a1012112796 commented Jun 18, 2020

As title.

@techknowlogick techknowlogick added this to the 1.13.0 milestone Jun 18, 2020
@lafriks
Copy link
Member

lafriks commented Jun 18, 2020

I don't think this fixes described issue

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 18, 2020
@a1012112796
Copy link
Member Author

a1012112796 commented Jun 18, 2020

I don't think this fixes described issue

Reason? Thanks 🤔

@a1012112796
Copy link
Member Author

@lafriks Maybe should recalculate the stars number when deieteing repo. is it right ? Thanks

@lafriks
Copy link
Member

lafriks commented Jun 18, 2020

I was more talking about issue you linked. But recalculation imho seems more reasonable otherwise it will not fix already invalid counts

@a1012112796
Copy link
Member Author

Hmm, Maybe should add migration to recalculate all , recalculate stars when deleting repo will cost too much time ..

@lafriks
Copy link
Member

lafriks commented Jun 18, 2020

Migration should be batched, see other migrations for examples

models/migrations/v143.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 20, 2020
@lafriks
Copy link
Member

lafriks commented Jun 20, 2020

We should backport this without migration, only bugfix itself

@GiteaBot GiteaBot removed the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jun 22, 2020
@a1012112796
Copy link
Member Author

@lunny How about this change? Thanks

models/migrations/v143.go Outdated Show resolved Hide resolved
Copy link
Member

@lunny lunny left a comment

Choose a reason for hiding this comment

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

Also for a big instance which has many users, the transaction maybe failed. So it's more reasonable to commit every 100 or 200 updates.

models/migrations/v143.go Outdated Show resolved Hide resolved
models/repo.go Show resolved Hide resolved
@a1012112796
Copy link
Member Author

@lunny Please review again, Thanks

@a1012112796 a1012112796 requested a review from lunny July 4, 2020 15:12
@lunny
Copy link
Member

lunny commented Jul 7, 2020

make L-G-T-M work.

@techknowlogick techknowlogick merged commit 12f9dd8 into go-gitea:master Jul 7, 2020
@techknowlogick
Copy link
Member

@a1012112796 thanks for PR :) Please send backport to release/v1.12 branch

@a1012112796 a1012112796 deleted the fix_star_num branch July 8, 2020 14:36
a1012112796 added a commit to a1012112796/gitea that referenced this pull request Jul 8, 2020
* Decrease the  num_stars when deleting a repo

fix go-gitea#11949

Signed-off-by: a1012112796 <[email protected]>

* Add migration

* use batch

* Apply suggestions from code review

Co-authored-by: Lauris BH <[email protected]>

* fix lint

* fix lint

* fix ci

* fix ci2

* add doctor

* duplicate code

* fix migration

* fix some nits

* add start

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
@zeripath zeripath added the backport/done All backports for this PR have been created label Jul 8, 2020
techknowlogick pushed a commit that referenced this pull request Jul 8, 2020
* Decrease the  num_stars when deleting a repo

fix #11949

Signed-off-by: a1012112796 <[email protected]>

* Add migration

* use batch

* Apply suggestions from code review

Co-authored-by: Lauris BH <[email protected]>

* fix lint

* fix lint

* fix ci

* fix ci2

* add doctor

* duplicate code

* fix migration

* fix some nits

* add start

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* Decrease the  num_stars when deleting a repo

fix go-gitea#11949

Signed-off-by: a1012112796 <[email protected]>

* Add migration

* use batch

* Apply suggestions from code review

Co-authored-by: Lauris BH <[email protected]>

* fix lint

* fix lint

* fix ci

* fix ci2

* add doctor

* duplicate code

* fix migration

* fix some nits

* add start

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants