Module: ChoreCollect
- Defined in:
- lib/chore/server.rb
Overview
Process submissions from a client and save it in the store.
Constant Summary collapse
- @@data_collector =
EM.spawn do |chore_info| Chore::Store.update_chore(chore_info) end
Instance Method Summary collapse
-
#chore_collect(chore_info) ⇒ Object
Sends data to the data_collector spawned process to add to the data store.
- #receive_data(data) ⇒ Object
Instance Method Details
#chore_collect(chore_info) ⇒ Object
Sends data to the data_collector spawned process to add to the data store.
15 16 17 |
# File 'lib/chore/server.rb', line 15 def chore_collect chore_info @@data_collector.notify chore_info end |
#receive_data(data) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/chore/server.rb', line 19 def receive_data(data) chore_info = JSON.parse(data) chore_collect chore_info rescue JSON::ParserError => ex warn "Ignoring invalid json, it probalby got truncated" warn data end |