-
Notifications
You must be signed in to change notification settings - Fork 82
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
[PGA] fix stars handling, reduce memory #80
Conversation
commaPos2 = strings.LastIndex(line[:commaPos2], ",") | ||
commaPos1 := strings.LastIndex(line[:commaPos2], ",") | ||
deletedFlag := line[commaPos1+1 : commaPos2] | ||
if deletedFlag != "0" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about the number of stars? If a repo is deleted, does it lose all the stars and the new one starts with 0?
Maybe we should take the maximum from the old and the new stars here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, deleted repositories do not keep their stars if re-created. I think getting actual stars is the least surprising one, since it accurately reflects current status. This is particularly important for cases where the re-created repository is not the main one anymore, but a fork.
- On repositories, skip every deleted repository. This means we have no more duplicated project entries anymore. - ID deduplication logic removed from writeWatchers. This also means reduced memory usage. - Use uint32 instead of int to hold project IDs and stars in memory. - Use gzip for stars file. Signed-off-by: Santiago M. Mola <santi@mola.io>
@@ -70,71 +70,78 @@ func reduceWatchers(stream io.Reader) map[int]int { | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of Atoi
you should use strconv.ParseUint(line[:commaPos], 10, 32)
to detect any overflow
pga-create: fix logic for deleted repositories, reduce mem
On repositories, skip every deleted repository. This
means we have no more duplicated project entries anymore.
ID deduplication logic removed from writeWatchers. This
also means reduced memory usage.
Use uint32 instead of int to hold project IDs and stars in memory.
Use gzip for stars file.