19
Views
3
Comments
Advice on processes/Timers/ServerActions
Question

The core of my task is to do some data validation. I've set up a process which works and validates on ~30 records just fine, although I noticed when building it it was a little slow (29 fields & I want to check each field for correct values/structure and then append to a list where there are errors).

The reality is the end user will be uploading 5,000+ records at a time, and a server action isn't going to cut it (could take 10 minutes). So i decided to break it down & use a process. This now works, but I didn't realise there was a 5 minute timeout on these, and I'm bumping into that.

So reading the guidance, it suggests I need to use a timer.

https://success.outsystems.com/Support/Enterprise_Customers/Maintenance_and_Operations/BPT_-_Automatic_Activities_Timeout

Before I go off an research how to use these - is this likely to do the job for me?

My current approach is:

> User uploads a CSV ~5k records through a client action

> Client action calls server action

> Server action writes the records into a temporary table.

> Final step of server action creates a record and triggers a Process

> Process calls second server action (which requires one input variable) and loops through temporary table doing data validation against a structure

> End of second server action writes to table detailing success/failure of process & cleans out temporary table.


Assuming timers will get me round the timeout issue;

  1. How would I restructure the above into a timer
  2. Where do I call the timer from? (a process? a server action?)
  3. How do I pass input variables into the server action through the timer? (session variable maybe?)


Would appreciate any advice before I go off down another path which may again not solve my problem...

Rank: #116

Hi,

Yes timer can achieve this but its recommended to have timeout set on timer as well (around 30 mins but lower timeout is also acceptable). Below is what I would suggest.

  1. Either load the excel into some temporary table and start the timer in step 2 or load the record into temp table and start the timer in step 3
  2. Read the excel and load into a temp table and delete the record from table
  3. Read the record from temp table may first 100, process them and mark them as process or delete it from temp table. If more records are found then start the same timer again.

Regards.

Rank: #116

Hi,

You can also check https://www.outsystems.com/learn/courses/43/master-class-on-best-practices-and-timers/, it a good resource for learning some best practices.

Regards.

mvp_badge
MVP
Rank: #69

Hi Steve.

Timers can run for longer than 20 minutes. That is the default. 


I would cut it even more.

1. User uploads a file. It is stored as binary. Timer is awaken.

2. Timer picks binary and stores as temporary records.Start Process.

3. Process asks for variable. Awakes timer #2.

3. Second timer validates data and creates final records.


This is clearer and easier to debug.