Skip to content

[CEP] Cache formplayer's validate_form's result on HQ to improve App Preview Refreshes #30147

@sravfeyn

Description

@sravfeyn

Abstract
Formplayer's validate_form is triggered during app-preview. This CEP proposes to cache the validation result on HQ side to save time when validating forms repeatedly while doing app-preview.

Motivation
On HQ, forms are validated during app build using Formplayer's validate_form endpoint. During app-preview the user might make small incremental changes, refresh the app preview triggering the app builds. The forms are validated using Formplayer's endpoint again for each request. Given this is an HTTP request for each form in an app and for each app-preview refresh, if we can cache the result of the form we can have faster app-preview refreshes.

Specification

validate_form takes form_xml as the argument. We can add two additional args one hash of the form_xml and the other form-id. These two arguments can be used to store in quickcache for a duration of a day. The cache can be cleared whenever the form is modified.

Impact on users
App builders using app-preview will see faster subsequent load times.

Impact on hosting
The number of redis keys will increase by the sum of the number of forms in each app that is being built/downloaded. The number of requests to Formplayer validate_form endpoint will reduce by a good margin.

Backwards compatibility
This doesn't cause any incompatibility.

Release Timeline
A PR to be followed up if the proposal is okay.

Open questions and issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    CEPCommCare Enhancement Proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions