I have defined a function
ConvertToMarkdown that does some long processing of a notebook: converts it to markdown, save inputs/outputs as images, generates a word cloud etc., that can take multiple seconds to run - for example, for a particular notebook the execution time is 17s.
This function runs fine when called from a notebook, but when I put it on a button in a palette, it only generates partial output (e.g., word cloud is not generated, and some other files). It was running fine from the palette before I've added the word cloud generation, as this is an expensive operation.
Looking at trace for (other, unrelated) messages from the same function, it looks like the palette function is run inside
TimeConstrained, which makes sense, as you want your front end to be responsive. The time limit is apparently 6 seconds,
which is numerically the same value as
Cell Options->Evaluation Options->DynamicEvaluationTimeout for my notebook, and even though I couldn't find an explicit confirmation in the documentation, I assume that's the parameter that controls the time limit.
My question is: what's the best way to temporarily increase this limit? I assume one option would be
SetOptions[$FrontEndSession, DynamicEvalutionTimeout -> 20] temporarily within the palette, and then reset it back to the original value; is this how I should do it?