jaros1 / Money-Network

Demo with complementary and alternative money. Implemented in ZeroNet and AngularJS. Focus on privacy, encryption, max data in client and min data on ZeroNet. Work in progress.
GNU General Public License v2.0
4 stars 4 forks source link

MoneyNetworkAPI - max wait time for a start_publish request #292

Closed jaros1 closed 6 years ago

jaros1 commented 6 years ago

Wallet publish workflow is:

Wait max seconds for a start_publish request. There could be communication problems, lost messages, stopped UI server or whatever.

jaros1 commented 6 years ago

Added wait_timeout function to queue_publish request. Waiting max 120 seconds for a start_publish request from MN.

jaros1 commented 6 years ago

Maybe already tested OK. Found in a number of old tests:

screenshot from 2017-12-21 18-53-05

jaros1 commented 6 years ago

Issue #262 Test 20 https://github.com/jaros1/Money-Network/issues/262#issuecomment-353338617. wait_timeout was executed but some issues in publish workflow:

jaros1 commented 6 years ago

Several queue_publish events at the same time. Hard to optimize as cb code is different for each publish event. Added better log and added reason to publish calls. Now writing publish reason before starting sitePublish and after finished with sitePublish. Should make logs easier to read.

jaros1 commented 6 years ago

Added extra fallback code in queue_publish.

jaros1 commented 6 years ago

Extra fallback code used in testcase 8A in issue #298 torando:

issue298-test8a-torando-mn.log issue298-test8a-torando-w2.log

18:58:27.519 MoneyNetworkAPI.js:2816 MoneyNetworkAPILib.queue_publish.wait_timeout/692: last_published = 1515607097, now = 1515607107, elapsed = 10
18:58:27.520 MoneyNetworkAPI.js:2832 MoneyNetworkAPILib.queue_publish.wait_timeout/692: Timeout while waiting for start_publish message from MN. starting publish in 20000 ms
18:58:48.519 MoneyNetworkAPI.js:2827 MoneyNetworkAPILib.queue_publish.wait_timeout/692: Timeout while waiting for start_publish message from MN. Starting publish now

Fallback code in wait_timeout was OK. Delayed publish in W2 session with 20 seconds. OK published message to MN. Publish interval in MN session was 31 seconds and no ratelimit error.

start_publish request from MN to W2 was never received by W2. W2 processed 5 other older incoming messages. Better to process newest messages first and wait with old messages. Should solve problems with MN-W2 processing. OK to try to process old messages but newest messages should have 1. priority. Changed order by in message_demon.