So I'm reinventing the wheel, but this needs to integrate with the rest of our site so Slash or Everything wouldn't easily work. Besides, I always think I can do better :)

Anyway, I'm writing up a bulletin board system, stealing ideas from any other system I can see. To improve performance in retrieving nested threads, I have a mapping field for each message. Like so:
Mapping IDNodeID
10241
20482</td
If node 3 is created in reply to Node 2, it would be inserted with Mapping ID 1536. (The real table has larger differences, to allow more levels of nesting) (Also, the parent-child relationship is recorded, but is irrelevant to this question)

So after a certain amount of nesting (I'm still working through the math), there will not be room for a new MapID, and ALL MapIDs must be recalcuated (I'd actually want to do this a few levels BEFORE required, to allow for detection time). I could either run this in a cron job, or I can have it triggered by the posting script.

My question (finally!) is a procedural one. Should I have a monitoring program check periodically, or should I have the user posting a message trip the program? Should I have the posting script do the work of recalculating the mapping IDs, or should it pass the task to an external program?


In reply to Perl handling of a MYSQL bulletin board by swiftone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.