@suffolklitlab/alkiln 4.10.3-feat-story-pics → 4.10.3-feat-debug-cache
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -40,8 +40,9 @@ Format:
|
|
|
40
40
|
-->
|
|
41
41
|
## [Unreleased]
|
|
42
42
|
## Added
|
|
43
|
-
- Contribution docs
|
|
44
|
-
- Story table can take screenshots after each visited page
|
|
43
|
+
- Contribution docs.
|
|
44
|
+
- Story table can take screenshots after each visited page.
|
|
45
|
+
- Projects created in da each have a unique name. We assume for now this will not build up test packages in the server.
|
|
45
46
|
|
|
46
47
|
## [4.10.3] - 2023-01-11
|
|
47
48
|
### Removed
|
|
@@ -204,16 +204,16 @@ da_i.loop_to_create_project = async function( creation_options ) {
|
|
|
204
204
|
let wait_seconds = creation_options.wait_seconds || 5;
|
|
205
205
|
|
|
206
206
|
let project_name = null;
|
|
207
|
-
let
|
|
207
|
+
let num_tries = 0;
|
|
208
208
|
|
|
209
209
|
// Try to create a project. If the project name is already taken, increment and loop again.
|
|
210
|
-
while (
|
|
211
|
-
|
|
210
|
+
while ( num_tries <= max_tries ) {
|
|
211
|
+
num_tries++;
|
|
212
212
|
try {
|
|
213
213
|
|
|
214
|
-
// Try
|
|
214
|
+
// Try adding a new timestamp to the name. Must remove all non-valid characters
|
|
215
215
|
// TODO: This sanitization is already done in session_vars, so remove it from here
|
|
216
|
-
project_name = session_vars.get_project_base_name().replace(/[^A-Za-z0-9]/g, '') +
|
|
216
|
+
project_name = session_vars.get_project_base_name().replace(/[^A-Za-z0-9]/g, '') + `${Date.now()}`;
|
|
217
217
|
log.info({ pre: `Trying to create a docassemble Project with the name ${ project_name }` });
|
|
218
218
|
let response = await _da_REST.create_project( project_name, timeout );
|
|
219
219
|
log.info({ pre: `The docassemble server is ready. Created a Project named ${ project_name }` });
|
|
@@ -226,7 +226,7 @@ da_i.loop_to_create_project = async function( creation_options ) {
|
|
|
226
226
|
|
|
227
227
|
if ( response && response.data ) {
|
|
228
228
|
if ( response.data.includes( `Invalid project` ) ) {
|
|
229
|
-
if (
|
|
229
|
+
if ( num_tries < max_tries ) {
|
|
230
230
|
// A non-unique project name. Try the next project name.
|
|
231
231
|
continue;
|
|
232
232
|
|
|
@@ -256,11 +256,11 @@ da_i.loop_to_create_project = async function( creation_options ) {
|
|
|
256
256
|
|
|
257
257
|
// If it's a timeout error, server is busy. Try again after waiting.
|
|
258
258
|
// Why are we using `max_tries` for timeout error as well?
|
|
259
|
-
if ( is_timeout_error( error ) &&
|
|
259
|
+
if ( is_timeout_error( error ) && num_tries < max_tries ) {
|
|
260
260
|
log.info({ pre: `The docassemble server was busy when we tried to `
|
|
261
|
-
+ `create the Project. Attempt ${
|
|
261
|
+
+ `create the Project. Attempt ${ num_tries } of `
|
|
262
262
|
+ `${ max_tries }. Will try again in ${ wait_seconds } seconds.` });
|
|
263
|
-
|
|
263
|
+
num_tries--; // Try this name again next time
|
|
264
264
|
await time.waitForTimeout( wait_seconds * 1000 );
|
|
265
265
|
continue;
|
|
266
266
|
|
|
@@ -272,6 +272,8 @@ da_i.loop_to_create_project = async function( creation_options ) {
|
|
|
272
272
|
} // ends type of non-response error
|
|
273
273
|
} // ends type of response error
|
|
274
274
|
} // ends try
|
|
275
|
+
|
|
276
|
+
// TODO: Add a message that we're done trying to create a project, successful or not
|
|
275
277
|
} // ends while
|
|
276
278
|
}; // Ends da_i.loop_to_create_project()
|
|
277
279
|
|
package/package.json
CHANGED