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.
This feels weird. So you sleep here but execute at most 15seconds?
There was a problem hiding this comment.
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.
| if ($this->social->existsAddressBook($stoppedAtBook, $userId) == false) { | |
| if ($this->social->existsAddressBook($stoppedAtBook, $userId)) { |
There was a problem hiding this comment.
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.
| if ($this->social->existsContact($stoppedAtContact, $stoppedAtBook, $userId) == false) { | |
| if ($this->social->existsContact($stoppedAtContact, $stoppedAtBook, $userId)) { |
nickvergessen
left a comment
There was a problem hiding this comment.
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