Skip to content

Postpone context creation #2240

@mdanilowicz

Description

@mdanilowicz

High volumes of bot and crawler traffic can cause excessive creation of sales_channel_api_context entries.
Currently, a context token is generated during page initialization, even if the visitor does not perform any action that actually requires a context.

As a result, crawlers that only fetch pages can trigger the creation of large numbers of unused contexts, leading to unnecessary database growth and potential performance issues.

Proposed Solution

Investigate whether the context token can be created lazily, only when it is actually required (e.g., when a request needs a valid sales channel context), instead of generating it during the initial page load.

Acceptance Criteria

  • Context tokens are not created automatically on page initialization.
  • Bot/crawler page requests that do not require a context do not generate new context entries.
  • Existing functionality that depends on the context remains unaffected.
  • Explain context token lifecycle in the documentation

Notes

The goal is to reduce unnecessary context creation caused by automated traffic while maintaining compatibility with existing storefront behavior.

Metadata

Metadata

Labels

No labels
No labels
No fields configured for Improvement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions