What is the purpose of publishing value each t to t in .u.pub?

| if[system"t"; |
|   | .z.ts:{pub’[t;value each t];@[.;t;@[;sym;g#]0#];i::j;ts .z.D}; | | &nbsp; | upd:{[t;x] | | &nbsp; | if[not -16=type first first x;if[d\<"d"$a:.z.P;.z.ts[]];a:"n"$a;x:$[0\>type first x;a,x;(enlist(count first x)#a),x]]; | | &nbsp; | t insert x;if[l;l enlist (upd;t;x);j+:1];}]; |

What do we use .z.ts to publish “value each t” to the “t” itself, I thought we just added updates to the table, not the whole table itself?

Why is this?

Hello,

Thank you for sharing your query with us, we’re working on feedback for you. 

Many Thanks,

Luke

This is batching mode when the timer t is set. https://code.kx.com/q/basics/syscmds/#t-timer 

In this mode the TP will cache data and only publish it when the timer triggers .z.ts https://code.kx.com/q/ref/dotz/#zts-timer 

In this case t is a list of tables and it calls pub on each of them (' form)  https://code.kx.com/q/ref/maps/#each 

value is called so that the cached data from the TP is populated in pub to send to subscribers (RDB etc.)

Some more information on batch mode: https://code.kx.com/q/wp/tick-profiling/ 

 

q)upd’[t;value each t] //A demo ‘upd’ which prints the parameters sent to it q)a:( c1:1 2 3) q)b:( c2:4 5 6) q)t:tables //Create list of tables q)t s#ab q)upd'[t;value each t] (a;+(,c1)!,1 2 3) (b;+(,`c2)!,4 5 6)