From 2c6c8feafcba4b606a77f329b17f170da71d88ce Mon Sep 17 00:00:00 2001 From: David Mitchard <99980315+dmitchard@users.noreply.github.com> Date: Mon, 5 Sep 2022 09:54:23 +0100 Subject: [PATCH 1/2] Add pubclear call for stpeoperiod and stpeod --- code/segmentedtickerplant/stplog.q | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/segmentedtickerplant/stplog.q b/code/segmentedtickerplant/stplog.q index ff08f6e89..4e4573b36 100644 --- a/code/segmentedtickerplant/stplog.q +++ b/code/segmentedtickerplant/stplog.q @@ -194,6 +194,8 @@ endofperiod:{[currentpd;nextpd;data] // stp runs function to send out end of period messages and roll logs // eop log roll is stopped if eod is also going to be triggered (roll is not stopped in SCTP) stpeoperiod:{[currentpd;nextpd;data;rolllogs] + .lg.o[`endofperiod;"flushing remaining data to subscribers and clearing tables"]; + .stpps.pubclear[.stplg.t]; .lg.o[`stpeoperiod;"passing on endofperiod message to subscribers"]; .stpps.endp[currentpd;nextpd;data]; // sends endofperiod message to subscribers currperiod::nextperiod; // increments current period @@ -221,6 +223,8 @@ endofday:{[date;data] // STP runs function to send out eod messages and roll logs stpeod:{[date;data] + .lg.o[`endofday;"flushing remaining data to subscribers and clearing tables"]; + .stpps.pubclear[.stplg.t]; .lg.o[`stpeod;"executing end of day for ",.Q.s1 .eodtime.d]; .stpps.end[date;data]; // sends endofday message to subscribers dayrollover[data]; From ef333dbbf9530b37dbf65e910f38511d0738299b Mon Sep 17 00:00:00 2001 From: David Mitchard <99980315+dmitchard@users.noreply.github.com> Date: Mon, 5 Sep 2022 12:57:51 +0100 Subject: [PATCH 2/2] Remove stpeod function as it is now identical to endofday --- code/segmentedtickerplant/stplog.q | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/code/segmentedtickerplant/stplog.q b/code/segmentedtickerplant/stplog.q index 4e4573b36..d5ae3179f 100644 --- a/code/segmentedtickerplant/stplog.q +++ b/code/segmentedtickerplant/stplog.q @@ -212,24 +212,15 @@ periodrollover:{[data] rolllog[multilog;dldir;rolltabs;data`p]; } -// endofday function defined in SCTP -// passes on eod messages to subscribers and rolls logs +// common eod for STP and SCTP to send out eod messages and roll logs endofday:{[date;data] .lg.o[`endofday;"flushing remaining data to subscribers and clearing tables"]; .stpps.pubclear[.stplg.t]; + .lg.o[`endofday;"executing end of day for ",.Q.s1 .eodtime.d]; .stpps.end[date;data]; // sends endofday message to subscribers dayrollover[data]; } -// STP runs function to send out eod messages and roll logs -stpeod:{[date;data] - .lg.o[`endofday;"flushing remaining data to subscribers and clearing tables"]; - .stpps.pubclear[.stplg.t]; - .lg.o[`stpeod;"executing end of day for ",.Q.s1 .eodtime.d]; - .stpps.end[date;data]; // sends endofday message to subscribers - dayrollover[data]; - } - // common eod log rolling logic for STP and SCTP dayrollover:{[data] if[(data`p)>.eodtime.nextroll:.eodtime.getroll[data`p]; @@ -252,7 +243,7 @@ checkends:{ // check for endofperiod if[nextperiod < x1:x+.eodtime.dailyadj; stpeoperiod[.stplg`currperiod;.stplg`nextperiod;.stplg.endofdaydata[],(enlist `p)!enlist x1;not .eodtime.nextroll < x]]; // check for endofday - if[.eodtime.nextroll < x;if[.eodtime.d<("d"$x)-1;system"t 0";'"more than one day?"]; stpeod[.eodtime.d;.stplg.endofdaydata[],(enlist `p)!enlist x]]; + if[.eodtime.nextroll < x;if[.eodtime.d<("d"$x)-1;system"t 0";'"more than one day?"]; endofday[.eodtime.d;.stplg.endofdaydata[],(enlist `p)!enlist x]]; }; init:{[dbname]