trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Peach <jpe...@apache.org>
Subject Re: Scheduling a recurrent task
Date Tue, 17 Dec 2013 18:16:45 GMT
On Dec 17, 2013, at 10:06 AM, Alan D. Cabrera <list@toolazydogs.com> wrote:

> 
> On Dec 17, 2013, at 9:38 AM, James Peach <jpeach@apache.org> wrote:
> 
>> On Dec 17, 2013, at 9:32 AM, Alan D. Cabrera <list@toolazydogs.com> wrote:
>> 
>>> 
>>> On Dec 16, 2013, at 7:47 AM, Leif Hedstrom <zwoop@apache.org> wrote:
>>> 
>>>> 
>>>> 
>>>>> On Dec 16, 2013, at 8:33 AM, "Alan D. Cabrera" <list@toolazydogs.com>
wrote:
>>>>> 
>>>>> I'm writing a plugin that performs a recurrent task, i.e. watches a file
system for changes.  What's the best way to do this in a ATS plugin?
>>>> 
>>>> Create a continuation and schedule it to run every so often on a TASK thread
.
>>>> 
>>>> You can alternatively have the continuation scheduled for a single run, and
have it reschedule itself. That's useful if the interval between invocations is not fixed.
>>> 
>>> As I consider it more carefully, I probably don't want to scan the file system
for changes but, instead, should wait for traffic_line to tell my server to re-read configs.
 Is there an event for that or does my plugin get restarted?
>> 
>> Is that a global or a remap plugin?
> 
> Both.

For remap plugins, you need to implement TSRemapNewInstance() and TSRemapDeleteInstance(),
<https://trafficserver.readthedocs.org/en/latest/reference/api/TSRemap.en.html>.

For global plugins, you need to register a callback with TSMgmtUpdateRegister(), for example
<https://github.com/apache/trafficserver/blob/master/plugins/gzip/gzip.cc#L798>.

J


Mime
View raw message