nutella_framework 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18b0a4b78dcf5b3bc8497085e8fd5c412f2ffc90
4
- data.tar.gz: 054da451f6f408fdbc21bcf7ee2d463beb7bec19
3
+ metadata.gz: 26af30aabc65345ca6428c429c8c56071eef4c79
4
+ data.tar.gz: 5f17e0dee35be84aa963402a74caaaea8c68f5d4
5
5
  SHA512:
6
- metadata.gz: 90573dfd9d4dbdd6a2b184f2c35c9078c1293d558892bf121899f70fdde8dd11932cc99be171a2d093056188c614f5b58662ec0742f93026775e811f01f3ff1a
7
- data.tar.gz: 273ce8c9853e697db91d785aa3c71912a5e94ab241827acb6791d7075d1b8a900df9cd1487c107a8108894c91e15921cb91fc8e5da30645c25b13ddcdcc18f5b
6
+ metadata.gz: 8f2788cdc05b4451eaae25ba781147e0022508b53374fc53eff29bb099172fbecb2996d1c7866ab5b1202bd0a16bb1da459aace650122d60bbd3ab008916d5d4
7
+ data.tar.gz: a6a6b43f2b137041410ab971909510d875fa21178aaa9393632cedf3e3977d5b4e629c80b4f194cd3d282b9c47f9e9efd0c39c7c6e97eddce4131efd1e6806a0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.5
1
+ 0.6.6
@@ -60,8 +60,16 @@ nutella.f.net.handle_requests_on_all_runs('configs/retrieve', lambda do |request
60
60
  }]
61
61
  }
62
62
  }
63
+ end
64
+
65
+ if configs_db['currentConfig'] == nil
63
66
  configs_db['currentConfig'] = 1
64
67
  end
68
+
69
+ if configs_db['launchTime'] == nil
70
+ configs_db['launchTime'] = Time.now.to_f * 1000
71
+ end
72
+
65
73
  reply
66
74
  end
67
75
  end)
@@ -92,10 +100,29 @@ nutella.f.net.subscribe_to_all_runs('currentConfig/update', lambda do |message,
92
100
  if new_config != nil
93
101
  configs_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'configs')
94
102
  configs_db['currentConfig'] = new_config
103
+
104
+ # Reset timer (enforces coupling new activity - new timer)
105
+ new_time = Time.now.to_f * 1000
106
+ configs_db['launchTime'] = new_time
107
+
108
+ # Notify Update
109
+ publish_current_config_update(app_id, run_id, new_config)
110
+ publish_launch_time_update(app_id, run_id, new_time)
111
+ end
112
+
113
+ end)
114
+
115
+ nutella.f.net.subscribe_to_all_runs('launchTime/update', lambda do |message, app_id, run_id, from|
116
+ new_time = message
117
+
118
+ # Update
119
+ if new_time != nil
120
+ configs_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'configs')
121
+ configs_db['launchTime'] = new_time
95
122
  end
96
123
 
97
124
  # Notify Update
98
- publish_current_config_update(app_id, run_id, new_config)
125
+ publish_launch_time_update(app_id, run_id, new_time)
99
126
  end)
100
127
 
101
128
  # Reacts to updates to config id by publishing the updated mapping
@@ -120,6 +147,15 @@ nutella.f.net.handle_requests_on_all_runs('currentConfig/retrieve', lambda do |r
120
147
  reply
121
148
  end)
122
149
 
150
+ nutella.f.net.handle_requests_on_all_runs('launchTime/retrieve', lambda do |request, app_id, run_id, from|
151
+ configs_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'configs')
152
+ reply = configs_db['launchTime']
153
+ if reply == nil
154
+ reply = Time.now.to_f * 1000
155
+ end
156
+ reply
157
+ end)
158
+
123
159
  nutella.f.net.subscribe_to_all_runs('channels/update', lambda do |message, app_id, run_id, from|
124
160
  new_channels = message
125
161
 
@@ -159,6 +195,11 @@ def publish_current_config_update(app_id, run_id, config_id)
159
195
  nutella.f.net.publish_to_run(app_id, run_id, 'currentConfig/ack_updated', config_id)
160
196
  end
161
197
 
198
+ # Sends the updated config id
199
+ def publish_launch_time_update(app_id, run_id, config_id)
200
+ nutella.f.net.publish_to_run(app_id, run_id, 'launchTime/updated', config_id)
201
+ end
202
+
162
203
  # Sends the whole new current configuration
163
204
  def publish_switch_config(app_id, run_id, mapping)
164
205
  nutella.f.net.publish_to_run(app_id, run_id, 'currentConfig/switched', mapping)