Skip to content

Pause & restore subscriber#26

Merged
mikelina merged 3 commits intofeature/logTimeSubscriberResponsefrom
feature/pauseSubscriber
May 5, 2026
Merged

Pause & restore subscriber#26
mikelina merged 3 commits intofeature/logTimeSubscriberResponsefrom
feature/pauseSubscriber

Conversation

@mikelina
Copy link
Copy Markdown
Contributor

@mikelina mikelina commented Apr 5, 2026

Create two new APIs:

  1. To pause a subscriber from receiving messages for one hour.
  2. To reactivate a subscriber that has been paused.

The code has been modified so that jobs for paused subscribers fail. This ensures that messages intended for the subscriber are persisted to the database and can be resent later without overloading the Elasticache memory.

@mikelina mikelina changed the base branch from master to feature/logTimeSubscriberResponse April 5, 2026 11:21
@vpasquino vpasquino self-requested a review April 22, 2026 09:24
Comment thread routes/api.php Outdated
Route::get('/', 'SubscriberController@getList');
Route::post('/', 'SubscriberController@store');
Route::get('{id}', 'SubscriberController@getSubscriber')->where('id', '[0-9]+');
Route::get('{id}/pause', 'SubscriberController@pauseSubscriber')->where('id', '[0-9]+');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Queste dovrebbero essere delle post, o c'è un motivo per cui sono delle get?

*/
public function pauseSubscriber($id)
{
$subscriber = $this->subscriberRepository->find($id);;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

;;

*/
public function restoreSubscriber($id)
{
$subscriber = $this->subscriberRepository->find($id);;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

;;

]);

$pausedKey = Config::get('cache.publisher_paused_key_prefix') . $this->event->channelSubscribe->subscriber_id;
if (Cache::has($pausedKey)) {
Copy link
Copy Markdown
Collaborator

@vpasquino vpasquino Apr 30, 2026

Choose a reason for hiding this comment

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

Se lo vuoi scrivere più carino e più corto if (Cache::has(config('cache.publisher_paused_key_prefix') . $this->event->channelSubscribe->subscriber_id))

if (!$subscriber) {
return response()->error404(__('messages.Subscriber') . $id);
}
Cache::put(Config::get('cache.publisher_paused_key_prefix') . $id, true, 3600);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Può valere la pena rendere customizzabile il ttl?

@LorenzoEmanuele00 LorenzoEmanuele00 self-requested a review May 4, 2026 08:08
@mikelina mikelina merged commit 67994d7 into feature/logTimeSubscriberResponse May 5, 2026
@mikelina mikelina deleted the feature/pauseSubscriber branch May 5, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants