Skip to content

Commit

Permalink
changed: make form updates propagate quicker in offline-capable views,
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnR committed Nov 3, 2015
1 parent 59bae44 commit 2952d83
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http:https://semver.org/).

[Unreleased]
[1.20.2] - 2015-11-02
---------------------
##### Changed
- Make form updates propagate quicker in offline webform views.

##### Fixed
- Themes with hyphen in name do not register.
- A label or hint that contains a \<span\> element without other markdown is not rendered as HTML.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "enketo-express",
"description": "A simplified version of Enketo Smart Paper that requires a constant connection to the server.",
"homepage": "",
"version": "1.20.1",
"version": "1.20.2",
"main": "./app.js",
"repository": {
"type": "git",
Expand Down
10 changes: 6 additions & 4 deletions public/js/src/module/form-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function init( survey ) {
return get( survey );
} )
.then( function( result ) {

if ( result ) {
return result;
} else {
Expand Down Expand Up @@ -45,10 +44,13 @@ function remove( survey ) {
function _setUpdateIntervals( survey ) {
hash = survey.hash;

// when it's pretty certain that the form has been rendered, check for form update
// Check for form update upon loading.
// Note that for large Xforms where the XSL transformation takes more than 30 seconds,
// the first update make take 20 minutes to propagate to the browser of the very first user(s)
// that open the form right after the XForm update.
setTimeout( function() {
_updateCache( survey );
}, 3 * 60 * 1000 );
}, 30 * 1000 );
// check for form update every 20 minutes
setInterval( function() {
_updateCache( survey );
Expand Down Expand Up @@ -194,7 +196,7 @@ function _updateCache( survey ) {
connection.getFormPartsHash( survey )
.then( function( version ) {
if ( hash === version ) {
console.debug( 'Cached survey is up to date!' );
console.debug( 'Cached survey is up to date!', hash );
} else {
console.debug( 'Cached survey is outdated! old:', hash, 'new:', version );
return connection.getFormParts( survey )
Expand Down

0 comments on commit 2952d83

Please sign in to comment.