[Sprint/GiddyGiraffe] (fix): don't show suggestions if near subscriptions ratelimit threshold
closes #267
0/2 discussions resolved
- Owner
Can this be moved to Manager with spec tests for safety?
- Last updated by Marcelo Rivera
24 $this->cacher = $cacher ?: Di::_()->get('Cache'); 25 $this->maps = $maps ?: Maps::$maps; 26 } 27 28 /** 29 * @param int|string $userGuid 30 */ 31 public function setUserGuid($userGuid) 32 { 33 $this->userGuid = $userGuid; 34 } 35 36 /** 37 * @return bool false if about to get rate limited 38 */ 39 public function check() - Owner
Ideally delegates should be stateless, so if we could pass $userGuid through as a variable vs class context
changed this line in version 3 of the diff
- Developer
fixed
- Owner
@eiennohi don't forget about these.. also failing spec tests
approved this merge request
22 $this->maps = $maps ?: Maps::$maps; 23 } 24 25 /** 26 * @param string|int $userGuid 27 * @return bool false if about to get rate limited 28 * @throws \Exception 29 */ 30 public function check($userGuid) 31 { 32 if (!$userGuid) { 33 throw new \Exception('userGuid must be provided'); 34 } 35 $threshold = $this->maps['interactions:subscribe']['threshold']; 36 37 $this->cached = $this->cacher->get("suggestions:user:$userGuid") ?? 0; - Developer
I'm not sure about having an instance property being used in both methods, as Delegates should be stateless, but this might be an edge case. Maybe we can return a composite value? Or move the cached read to a third method in this class and pass it thru to check() and cache() via arguments. @markeharding what do you think?