Differences From
Artifact [71eb9101d9]:
4 4 return pstr { ptr = s, ct = lib.str.sz(s) }
5 5 end
6 6
7 7 local terra
8 8 render_tweet(co: &lib.srv.convo, p: &lib.store.post, acc: &lib.str.acc)
9 9 var author: &lib.store.actor
10 10 for j = 0, co.actorcache.top do
11 - lib.io.fmt('scanning cache for author %llu (%llu/%llu)\n', p.author, j, co.actorcache.top)
12 11 if p.author == co.actorcache(j).ptr.id then
13 12 author = co.actorcache(j).ptr
14 - lib.io.fmt('cache hit on idx %llu, skipping db lookup\n', j)
15 13 goto foundauth
16 14 end
17 15 end
18 - lib.io.fmt('cache miss, checking db for id %llu\n', p.author)
19 16 author = co.actorcache:insert(co.srv:actor_fetch_uid(p.author)).ptr
20 - lib.io.fmt('got author %s\n', author.handle)
21 17
22 18 ::foundauth::
23 19 var avistr: lib.str.acc if author.origin == 0 then
24 20 avistr:compose('/avi/',author.handle)
25 21 end
26 22 var timestr: int8[26] lib.osclock.ctime_r(&p.posted, ×tr[0])
27 - lib.io.fmt('got body %s\n', author.handle)
28 23
29 24 var bhtml = lib.smackdown.html([lib.mem.ptr(int8)] {ptr=p.body,ct=0}) defer bhtml:free()
30 25
31 26 var idbuf: int8[lib.math.shorthand.maxlen]
32 27 var idlen = lib.math.shorthand.gen(p.id, idbuf)
33 28 var permalink: lib.str.acc permalink:compose('/post/',{idbuf,idlen})
34 29