From 7159e2e9d2e2fb7b7ed09b99e77c3fa1023dfd5d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 1 Nov 2019 21:23:59 +0000 Subject: [PATCH] Change method name --- daemon.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/daemon.py b/daemon.py index b9957433..abe0f40b 100644 --- a/daemon.py +++ b/daemon.py @@ -2438,7 +2438,8 @@ class PubServer(BaseHTTPRequestHandler): def do_HEAD(self): self._set_headers('application/json',0,None) - def _receiveNewPostThread(self,authorized: bool,postType: str,path: str,headers: {}) -> int: + def _receiveNewPostProcess(self,authorized: bool,postType: str,path: str,headers: {}) -> int: + # Note: this needs to happen synchronously # 0 = this is not a new post # 1 = new post success # -1 = new post failed @@ -2747,15 +2748,10 @@ class PubServer(BaseHTTPRequestHandler): headers[dictEntryName]=headerLine print('New post headers: '+str(headers)) - #print('Creating new post thread: '+newPostThreadName) - #self.server.newPostThread[newPostThreadName]= \ - # threadWithTrace(target=self._receiveNewPostThread, \ - # args=(authorized,postType,path,headers),daemon=True) - #print('Starting new post thread') - #self.server.newPostThread[newPostThreadName].start() - + # Note sending new posts needs to be synchronous, otherwise any attachments + # can get mangled if other events happen during their decoding print('Creating new post: '+newPostThreadName) - self._receiveNewPostThread(authorized,postType,path,headers) + self._receiveNewPostProcess(authorized,postType,path,headers) return pageNumber def do_POST(self):