vipickering / mastr-cntrl

A Micropub Microservice
MIT License
26 stars 2 forks source link

Double webmention bug/Missing Webmentions #51

Closed vipickering closed 5 years ago

vipickering commented 5 years ago

Posting on swarm and backfeeding is suddenly resulting in occasional double posting of webmentions or dropped mentions

I have also spotted a failed attempt to update the webmention.json file.

Add some extra logging around all webmention functionality and track behaviour to analyse why this is happening.

vipickering commented 5 years ago

The failed update to the webmention.js file is because the async process results in a race condition. if 2 webmentions are submitted (eg from a swarm) they both try to update the file at the same time and fail.

vipickering commented 5 years ago

Expanding on above.

When webmention.io sends the Webmentions to Mastr Cntrl; The promise function performs a GET on the file, to get its current GIT status. Because the promise moves on and doesn't queue up the requests what actually can happen is that two requests GET the same position, but in the time one of the requests updates the file (and changes the position) the second tries to update, sees the position is now different and the request is rejected.

I either need to:

vipickering commented 5 years ago

I have successfully split up webmentions in to separate files and the service will loop through them and add correctly.

I am now testing they are created correctly via Mastr Cntrl.

vipickering commented 5 years ago

Fixed. Testing is working perfectly