gets appended... file size keeps getting bigger, mtime updated, etc.
When you hang up or choose a posting option, the Asterisk AGI script drops a "queue info" file beside it, with info on where/how to post it:
Now, phonepostd comes along and looks at all the files in this spool directory.
If a qinfo file is there, and the wav is there, it needs to be encoded to:
Once that's done, the ogg needs to be uploaded to the user's blob cluster, and a blobid returned.
Once that's done, the LJ post is made.
But keep in mind that any step can fail:
-- encoding the ogg -- posting to blob server -- posting to LJ
So it writes up a diagnostic at:
If any part fails. But it never looks at that text. It just uses the mtime of the *.err file to know how long ago it last failed and delay retrying too quick.
It adds state info to the *.qinfo file... like storing the blobid and seconds of the file (from the encoding and upload steps) once those files are deleted, before the LJ post is made.
Before this was all very hokey, and some error cases weren't handled. Finally cleaned it all up and made it robust.
The deletion reference was that we have a rule "If $userid-$posttime.* exists, but not the corresponding *.qinfo file, delete all those files, since we can't do anything." That's useful both to clean up historic crud, and used to clean up itself.
But the rewrite initially contained a bug where we'd delete a recording in progress (*.wav) because it existed and there was no correspoding *.qinfo. Added in a check for that.