Hi all - Just wondering if there’s any consensus or best practice guide for deciding how best to perform an intensive process in web edition (e.g. calculating payroll process for a bunch of staff selected in a webdialog, generating a series of reports to a single PDF in a batch, and so on).
I’ve adopted the practice of pages displaying content only, with dialogs providing all the necessary editing, selection of staff to be paid etc, however when it comes to performing a lengthy task I tried all ways to thread the process from the dialog (can’t - threads don’t work in dialogs, nor do webtimers, settimer etc - these produce illegal cast exceptions because a dialog isn’t a page, and timers run on forever (still) after the dialog has closed, or it crashes).
So, for the time being I just execute the process then release the dialog, which notifies the page that it needs refreshing - but I’m concerned that there may be a hit on performance for other users, even for the few seconds these processes take to run. It’s fine for small numbers of records being processed, but it doesn’t look like it’ll scale well.
I’d prefer not to: release the dialog then run the process in a thread (showing yet another progress dialog then refresh the page when it’s done) - I’m not sure it’s worthwhile doing it that way - never liked threads, messy/evil things.
The same issues present if I was to spawn a console app to do the work - at some point it still needs to inform the user or refresh the page and in the meantime they could go do something else, but payroll is very task-oriented and the job at hand needs doing (as fast as possible with minimal disruption to other users).
I’d prefer to be able to have the process show it’s progress and complete while in the same WebDialog (it just makes sense and looks tidier), but not being able to implement progress etc in the same dialog is frustrating - and messy to close one just to show another.
So, the question is: Is it better to just run the code (easiest), pass the job to a thread handled in the page (displaying another wait/progress dialog), or spawn the task to a console app?
Any (good) advice is much appreciated.