urgent/thisbounty.com-events

Init leads

Closed this issue · 8 comments

  • Bounties in static CDN.

  • Read leads from local storage.

  • Click bounty, websocket sends request for more leads. Data payload of existing leads

  • Need lends algo. Right now, env value for lead threshold. See #22 #26

  • Listen to websocket for new leads.

How to keep authority on health and money?

Websocket

  • Moneybar capacity, all full length, need to be short
  • Heal life
  • Hurt life
  • Heal money
  • Hurt money
  • Add heart
  • Add money
  • Authority animation, showing this came from web server or peer See #27
  • Queue for consensus. Pending heals and hurts need to be cleared before next ones. See #28
  • Consensus rules, multiple comments in github can get approval. See #29

Add heart and money in bounty.

Options:
Netlify build only updates. Safe, but no real time.
Websocket has full permissions. Initial load, then adjustment on websocket. No first class offline. <-- start here
Load empty or minimal, then websocket fills up. Once again, no first class offline.
Split, like a stamina bar refill. Grey bar in front of money bar, or blinking hearts. One for build other for websocket. Complicated, and needs more styles.
Consensus algo. Make request, other people need to vote before it's broadcast. Complicated. Prone to hacking.

Style factory, theme

#3.20

Pass a prop to a component. Pass prop to a view. In view, add conditions to create a class. Use either and folds or combinators for advance usage. Use sass ampersand for styles. Reference bounty component.

Read from Local Storage Once

#3.21

Use [] as useEffect dependency to read from local storage only once.

Cases:
0 response
1 response: buffer might skip.
just right peers respond
spam peers respond

Sending a read leads tells itself to read leads. Skip with state? true/false.
Do not send a read leads that's empty
Chatty. Why do all users have to respond?

Approach:

  • Separate effect file
  • Unit tests
  • State for REQUEST, RESPONSE. If state closed, ignore.
  • If no leads, don't respond
  • If under threshold, don't respond
  • If over threshold, don't request
  • Timer on send, wait on random intervals, read incoming, and send if no one else sent <-- need state for send status See #30
  • Timer on read before changing state, read multiple as a buffer, then change state. See #30
  • Change NEED/READ to REQUEST/RESPONSE
  • Send 200 SUCCESS when no longer needed See #34
  • Check data in REQUEST_LEADS before sending response, io-ts decode
  • Make sure response leads are unique to request
  • Add to local storage
  • Check fp-ts Json in receive, socket to event See #33

Request Response on Websocket

#4.9

Share data among peers by sending a REQUEST event to websocket, and responding with a RESPONSE. Runtime validation on message. Buffer on RESPONSE to accept only a few. Buffer on REQUEST to send only a few. Random intervals on timeout so response spreads. 201 SUCCESS code to acknowledge REQUEST received.

Two websockets connections for test

#4.10

No consistent echo on websocket. Send may not always receive, especially in test. To fix, use separate websocket connection to receive.

Procedure to write an effect

Do not use. Use monadic interface instead.

#3.22

Red/Green test for:

  1. Action Write a unit test to check action performs effect with local variables. Can mock deps to throw, and check if test throws. Start with a reader pattern. Take input of dependencies. Run effectual action with dependencies methods, set state or write to database.

  2. Make Create unit tests that make returns a function with valid input, and an error for invalid input. make accepts input of parameters needed to validate, and returns a reader for action and dependencies.

  3. Effectful action Create unit tests for the top level, that the effect performs the action. Pipe make to effect/exec

  4. Validation validate each unit. Test with effect

Concurrency in Copy Webpack Plugin for EMFile Open File Limit

#1.7

Install watchman, set /etc/sysctl.conf

fs.inotify.max_user_watches = 999999
fs.inotify.max_queued_events = 999999
fs.inotify.max_user_instances = 999999

facebook/watchman#163 (comment)