-
Notifications
You must be signed in to change notification settings - Fork 173
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
Update social avatars in chunks #1745
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1745 +/- ##
============================================
- Coverage 40.05% 36.87% -3.18%
- Complexity 128 162 +34
============================================
Files 17 19 +2
Lines 377 499 +122
============================================
+ Hits 151 184 +33
- Misses 226 315 +89
Continue to review full report at Codecov.
|
13bf720
to
169ae41
Compare
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
169ae41
to
1831bc4
Compare
What is the status here? Please update labels :) |
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
I removed the optimization, so we can merge this. |
@rullzer @ChristophWurst @nickvergessen can I have a backgroundjob expert to do a quick review? 🙏 |
} | ||
|
||
// delay to prevent rate limiting issues | ||
sleep($delay); |
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.
This feels weird. So you sleep here but execute at most 15seconds?
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.
Well, this delay is to be compliant to the terms of service of social networks, so I don't want to remove it. And the 15seconds of maximum execution time are to prevent that the update runs forever on huge installations.
How would you propose to tackle this?
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
$stoppedAtContact = $report[0]['stoppedAt']['contact']; | ||
|
||
// make sure the offset contact/address book are still existing | ||
if ($this->social->existsAddressBook($stoppedAtBook, $userId) == false) { |
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.
if ($this->social->existsAddressBook($stoppedAtBook, $userId) == false) { | |
if ($this->social->existsAddressBook($stoppedAtBook, $userId)) { |
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.
Thank you for your review and good comments!
I suppose this should now start with if(!$this
? Or was the negation done on purpose?
(same for the next suggested change)
if ($this->social->existsAddressBook($stoppedAtBook, $userId) == false) { | ||
$stoppedAtBook = null; | ||
} | ||
if ($this->social->existsContact($stoppedAtContact, $stoppedAtBook, $userId) == false) { |
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.
if ($this->social->existsContact($stoppedAtContact, $stoppedAtBook, $userId) == false) { | |
if ($this->social->existsContact($stoppedAtContact, $stoppedAtBook, $userId)) { |
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.
Looks good, but I didn't execute it
add elegance from nickvergessen Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com> Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
c3c7662
to
c03bd90
Compare
Ready to go I guess? |
When there are a lot of contacts, the background update of avatars from social networks shall be split into chunks