I may have a file locking problem... or rather, a lack of file-locking, and if I upload multiple markdown files at once, the StructureHandler may overwrite itself as multiple lambdas fire at once.
Options:
- Don't allow multiple file uploads at once (needs a UI and controls)
-
- would have to move the StructureHandler out of the file upload handler, but that's no bad thing
- Don't try to update the structure until all the file uploads are done (how?)
Update on buckets 20230112
I have learned that I can apply a filter to Lambda S3 event triggers, so that they only apply for a given prefix. So I can configure the FileUploadHandler
to only fire when files are uploaded to a particular folder, such as "sources". Then when new files are generated, they can be put in a different folder which won't trigger the lambda. I like that, and will probably want a folder structure like:
sources/
for the markdown filestemplates/
for the handlebars filesassets/
for css, javascript and the likemedia/
for images and other user-uploaded documentsgenerated/fragments/
for generated HTML fragments prior to template processing- other
generated/
subfolders as needed.
This will mean I do not need the third, temporary bucket, which pleases me.
Once I introduce the concept of multiple projects, the structure may become sources/<projectID>/
etc.