1 | <accessor debug="false"> |
---|
2 | <name>ISOcat.access.data.cleanup</name> |
---|
3 | <descr>Cleanup stale sessions and locks in the DBMS.</descr> |
---|
4 | <idoc> |
---|
5 | <instr> |
---|
6 | <type>sqlUpdate</type> |
---|
7 | <operand> |
---|
8 | <sql> |
---|
9 | DELETE |
---|
10 | FROM core_session |
---|
11 | WHERE (now() - COALESCE(last_access,first_access)) > interval '00:05:00' |
---|
12 | ; |
---|
13 | </sql> |
---|
14 | </operand> |
---|
15 | <target>var:result</target> |
---|
16 | </instr> |
---|
17 | <if> |
---|
18 | <cond> |
---|
19 | <instr> |
---|
20 | <type>sloot.xpath2eval</type> |
---|
21 | <operand>var:result</operand> |
---|
22 | <operator> |
---|
23 | <xpath>number(.)>0</xpath> |
---|
24 | </operator> |
---|
25 | <target>this:cond</target> |
---|
26 | </instr> |
---|
27 | </cond> |
---|
28 | <then> |
---|
29 | <instr> |
---|
30 | <type>sloot.xquery</type> |
---|
31 | <operator> |
---|
32 | <xquery> |
---|
33 | declare variable $sessions as node() external; |
---|
34 | <msg>INF: {current-dateTime()}:ISOcat.access.data.cleanup: deleted stale sessions[{string($sessions)}]</msg> |
---|
35 | </xquery> |
---|
36 | </operator> |
---|
37 | <sessions>var:result</sessions> |
---|
38 | <target>var:msg</target> |
---|
39 | </instr> |
---|
40 | <instr> |
---|
41 | <type>sloot.log</type> |
---|
42 | <operand>var:msg</operand> |
---|
43 | </instr> |
---|
44 | </then> |
---|
45 | </if> |
---|
46 | <instr> |
---|
47 | <type>sqlUpdate</type> |
---|
48 | <operand> |
---|
49 | <sql> |
---|
50 | DELETE |
---|
51 | FROM generic_lock |
---|
52 | WHERE (now() - COALESCE(last_access,first_access)) > interval '00:05:00' |
---|
53 | ; |
---|
54 | </sql> |
---|
55 | </operand> |
---|
56 | <target>var:result</target> |
---|
57 | </instr> |
---|
58 | <if> |
---|
59 | <cond> |
---|
60 | <instr> |
---|
61 | <type>sloot.xpath2eval</type> |
---|
62 | <operand>var:result</operand> |
---|
63 | <operator> |
---|
64 | <xpath>number(.)>0</xpath> |
---|
65 | </operator> |
---|
66 | <target>this:cond</target> |
---|
67 | </instr> |
---|
68 | </cond> |
---|
69 | <then> |
---|
70 | <instr> |
---|
71 | <type>sloot.xquery</type> |
---|
72 | <operator> |
---|
73 | <xquery> |
---|
74 | declare variable $locks as node() external; |
---|
75 | <msg>INF: {current-dateTime()}:ISOcat.access.data.cleanup: deleted stale locks[{string($locks)}]</msg> |
---|
76 | </xquery> |
---|
77 | </operator> |
---|
78 | <locks>var:result</locks> |
---|
79 | <target>var:msg</target> |
---|
80 | </instr> |
---|
81 | <instr> |
---|
82 | <type>sloot.log</type> |
---|
83 | <operand>var:msg</operand> |
---|
84 | </instr> |
---|
85 | </then> |
---|
86 | </if> |
---|
87 | <instr> |
---|
88 | <type>copy</type> |
---|
89 | <operand>active:sloot.void</operand> |
---|
90 | <target>this:response</target> |
---|
91 | </instr> |
---|
92 | </idoc> |
---|
93 | <exception> |
---|
94 | <debug/> |
---|
95 | <trace>ffcpl:/trace/cleanup.exception.xml</trace> |
---|
96 | <throw/> |
---|
97 | </exception> |
---|
98 | <response> |
---|
99 | <expire>now</expire> |
---|
100 | <debug>ffcpl:/trace/cleanup.response.xml</debug> |
---|
101 | </response> |
---|
102 | </accessor> |
---|
103 | |
---|