Skip to content
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

Allow suspending sequential revalidations if network request fails #695

Open
mglaman opened this issue Feb 21, 2024 · 0 comments
Open

Allow suspending sequential revalidations if network request fails #695

mglaman opened this issue Feb 21, 2024 · 0 comments
Labels
area: next module enhancement New feature or request

Comments

@mglaman
Copy link
Contributor

mglaman commented Feb 21, 2024

Package

next (Drupal module)

Describe the feature request

If there is an issue making a network request from Drupal to the Next.js site, additional failing requests can be sent out that wil also fail and add additional logs/processing time.

Describe the solution you'd like

If the first revalidation hits a network error or server error, halt sending any further validations.

Something like private readonly bool $halt = false in EntityActionEventRevalidateSubscriber and:

    if (!$this->halt && $revalidator = $this->nextEntityTypeManager->getRevalidator($event->getEntity())) {
      try {
        $revalidated = $revalidator->revalidate($event);
        // Dispatch post revalidation event.
        $revalidated_event = EntityRevalidatedEvent::createFromEntityActionEvent($event);
        $revalidated_event->setRevalidated($revalidated);
        $this->eventDispatcher->dispatch($revalidated_event, EntityEvents::ENTITY_REVALIDATED);
      catch (Exception) {
          $this->halt = true;
      }     
    }

If #445 this would be like re-queueing the existing item and suspending the queue.

Describe alternatives you've considered

Additional context

Add any other context about the problem here.

@mglaman mglaman added enhancement New feature or request triage A new issue that needs triage labels Feb 21, 2024
@JohnAlbin JohnAlbin added area: next module and removed triage A new issue that needs triage labels Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: next module enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants