The fnid is the ID of a function.
(def morelink (f items label title . args)
(tag (a href
(url-for
(afnid (fn (req)
(prn)
(with (url (url-for it) ; it bound by afnid
user (get-user req))
(newslog req!ip user 'more label)
(longpage user (msec) nil label title url
(apply f user items label title url args))))))
rel 'nofollow)
(pr "More")))
The Hacker News code keeps a table of anonymous functions (see the fn (req) definition there) that can be run later to generate a page. The fnid is the unique ID of that function (which is generated randomly) (def new-fnid ()
(check (sym (rand-string 10)) ~fns* (new-fnid)))
(def fnid (f)
(atlet key (new-fnid)
(= (fns* key) f)
(push key fnids*)
key))
So, when you hit a URL with a fnid in it the fnid is looked up in the fns* table and the function executed to produce the page. There's a reaper function that deletes fnids that are older than a timeout value (which is how you got the Expired Link error. (def harvest-fnids ((o n 50000)) ; was 20000
(when (len> fns* n)
(pull (fn ((id created lasts))
(when (> (since created) lasts)
(wipe (fns* id))
t))
timed-fnids*)
(atlet nharvest (trunc (/ n 10))
(let (kill keep) (split (rev fnids*) nharvest)
(= fnids* (rev keep))
(each id kill
(wipe (fns* id)))))))