question

Upvotes
Accepted
68 3 7 10

Purging the objects on the server

Hello everybody,

I have the task to delete all objects (schedules, instruments lists, report templates, and returned files), on TR server, pertaining to asynchronous requests that we sent, between two dates (or in fact until a certain date).

The way I found was to list the objects, and for each, call the Delete method, of ScheduleOperations, InstrumentListOperations, ReportTemplateOperations ...

Apart from the fact that I have to review the notion of pagination to get more than the first 250 objects of each sort, I see that each deletion takes about 7 to 8 seconds.

For the test phase it can seem OK, but when the real operations are started we can have too numerous objects to take so much time to purge them.

Any hint about this ?

The test application examples propose to delete the objects as soon as the results are received, but that does not seem to be coherent with the needs as some debate can appear about an operation or another some time after the extraction.

tick-history-rest-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
13.7k 26 8 12

@Hubert CANEVET, the only reason why our sample codes delete objects immediately after results are received is to avoid cluttering up your environment with objects created by demo code. That does not mean you should proceed this way, your workflow should serve your own business and technical requirements.

Personally I'd use On Demand extractions for all asynchronous requests, instead of Scheduled extractions (if you are not familiar with the difference between these 2 methods, see here). When you use on demand extractions nothing is left lying around on the server, so there is no need to purge anything.

But if you want to use scheduled extractions and keep objects on the server for a certain time then you will have to create a purging mechanism. In that case I'd recommend you create a separate process to run in the background and purge old items. Usually garbage collection is not under stringent time constraints.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
68 3 7 10

Hello,

Thank you for your answer.

I am afraid we are too advanced in the development to consider choosing another architecture, I remember I asked the question about calling certain report types synchronously, the answer did not encourage a lot to go that way.

So I am going to pursue using loops for the purging. Do you have an idea whether it is possible to launch several such treatments concurrently with the same account, in case one treatment is not quick enough ?

To launch queries it is possible with the API, I presume to delete the objects it should be the same.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
13.7k 26 8 12

@Hubert CANEVET, yes you should be able to delete objects using several parallel queries.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
68 3 7 10

Oh, still one thing to verify : if I delete an extraction, that also deletes the files that come with it, does not it ?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@Hubert CANEVET, if you delete a schedule it does not delete the files it generated. Note those files are automatically purged by the servers themselves, after 45 days.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.