mrpin-sdk 1.0.67 → 1.0.68

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c58fcd657411dc9578dbcfc84b5f636199f5ef84
4
- data.tar.gz: e1c376cae2bc00a37760fd1bf4ddc6e136cda91c
3
+ metadata.gz: 35e878ab9ad7d51fed9701329bd097ad86ec8f8a
4
+ data.tar.gz: ed40421a7ea0ce2e6cf9738eeb89255e45a66217
5
5
  SHA512:
6
- metadata.gz: 938f00f20b13febcdf1626270fe4355cce9fc90161f608a06f74e588772f4bd899f18f91211e74bc718741209f240d25b3eb2ab128b61030d111d3a48a087b07
7
- data.tar.gz: 7c4d09ddee9fd2847642f80855f1e54acb709a3930ab7bd41ae76325f66fb829fcf58a7ef15ab7bf98d0245a9d1480aed91c0c40ee83b2b45e3b27f38ed96c9a
6
+ metadata.gz: d618c1821923815f9d1a400e4924d9a3a4e774b29b328a42ad2d46f7bd19e5a804cce16cc8a522d69e4ddb6ca9b2023a6cdfdffbf33c8512c98b203a2191c4b5
7
+ data.tar.gz: 4610355794f804be2ee7f81b40e5e592dfc840e7dae5481462da9dc00bd7497fc85c5b03fe45a627ab9d0898ed9c4c968a71215c91f25a8de01a810e5ed0be57
@@ -24,40 +24,13 @@ class AppInfoBase
24
24
  def state=(value)
25
25
  return if @state == value
26
26
 
27
+ on_change_state_before(value)
28
+
27
29
  @state = value
28
30
 
29
- unless @logger.nil?
30
- @logger.info("app state is #{@state}")
31
- end
31
+ @logger.info("app state is #{@state}") unless @logger.nil?
32
32
 
33
- case @state
34
- when EAppState::EAS_INIT_CONFIG
35
- init_config
36
- when EAppState::EAS_INIT_MANAGERS
37
- init_managers
38
- when EAppState::EAS_POST_INIT
39
- call_in_all_managers_with_benchmark('[POST_INIT]', 'post_init')
40
- when EAppState::EAS_LOAD_INIT_DATA
41
- call_in_all_managers_with_benchmark('[LOAD_DATA]', 'load_init_data')
42
-
43
- call_in_all_managers('on_data_loaded')
44
- when EAppState::EAS_INIT_PERIODICAL_TASKS
45
- init_periodical_tasks
46
- when EAppState::EAS_START_MANAGER_TASKS
47
- call_in_all_managers('start_tasks', 0.1)
48
- when EAppState::EAS_START_REMOTE_SERVERS
49
- start_remote_servers
50
- when EAppState::EAS_LAUNCH_COMPLETE
51
- call_in_all_managers('on_server_started')
52
-
53
- @boot_time = Time.now
54
- when EAppState::EAS_MAINTENANCE
55
- on_server_maintenance_on
56
- when EAppState::EAS_SHUTDOWN_STARTED
57
- call_in_all_managers('on_server_shutdown')
58
- else
59
- #do nothing
60
- end
33
+ on_change_state_after(value)
61
34
 
62
35
  nil
63
36
  end
@@ -101,9 +74,57 @@ class AppInfoBase
101
74
  # Events
102
75
  #
103
76
 
77
+ protected
78
+ def on_change_state_before(state)
79
+ case state
80
+ when EAppState::EAS_POST_INIT
81
+ call_in_all_managers_with_benchmark('[POST_INIT]', 'post_init')
82
+ when EAppState::EAS_LOAD_INIT_DATA
83
+ call_in_all_managers_with_benchmark('[LOAD_DATA]', 'load_init_data')
84
+
85
+ call_in_all_managers('on_data_loaded')
86
+ when EAppState::EAS_START_MANAGER_TASKS
87
+ call_in_all_managers('start_tasks', 0.1)
88
+ when EAppState::EAS_LAUNCH_COMPLETE
89
+ call_in_all_managers('on_server_started')
90
+
91
+ @boot_time = Time.now
92
+ when EAppState::EAS_SHUTDOWN_STARTED
93
+ call_in_all_managers('on_server_shutdown')
94
+ else
95
+ #do nothing
96
+ end
97
+
98
+ nil
99
+ end
100
+
101
+ protected
102
+ def on_change_state_after(state)
103
+ case state
104
+ when EAppState::EAS_INIT_CONFIG
105
+ init_config
106
+ when EAppState::EAS_INIT_MANAGERS
107
+ init_managers
108
+ when EAppState::EAS_INIT_PERIODICAL_TASKS
109
+ init_periodical_tasks
110
+ when EAppState::EAS_START_REMOTE_SERVERS
111
+ start_remote_servers
112
+ when EAppState::EAS_MAINTENANCE
113
+ on_server_maintenance_on
114
+ else
115
+ #do nothing
116
+ end
117
+
118
+ nil
119
+ end
120
+
104
121
  protected
105
122
  def on_server_launch_complete
106
- self.state = @config.server_on_maintenance ? EAppState::EAS_MAINTENANCE : EAppState::EAS_LAUNCH_COMPLETE
123
+ if @config.nil? || @config.server_on_maintenance
124
+ self.state = EAppState::EAS_MAINTENANCE
125
+ else
126
+ self.state = EAppState::EAS_LAUNCH_COMPLETE
127
+ end
107
128
 
108
129
  nil
109
130
  end
@@ -76,8 +76,6 @@ class ManagerRemoteSocketBase < ManagerBase
76
76
  def post_init
77
77
  super
78
78
 
79
- @manager_scheduler = AppInfo.instance.manager_scheduler
80
-
81
79
  register_classes
82
80
  register_handlers
83
81
 
@@ -141,13 +139,4 @@ class ManagerRemoteSocketBase < ManagerBase
141
139
  nil
142
140
  end
143
141
 
144
- protected
145
- def disconnect_all_if_maintenance
146
- return unless AppInfo.instance.is_server_on_maintenance?
147
-
148
- self.disconnect_all_with_message(EStringTypeBase::EST_ERROR_SERVER_ON_MAINTENANCE)
149
-
150
- nil
151
- end
152
-
153
142
  end
@@ -99,15 +99,9 @@ class ManagerRemoteWebSockets < ManagerRemoteSocketBase
99
99
  params[:tls_options] = tls_options
100
100
  end
101
101
 
102
- callback_disconnect = Proc.new do
103
- disconnect_all_if_maintenance
104
- end
105
-
106
102
  EM::WebSocket.run(params) do |websocket|
107
103
  client = @class_client.new(websocket)
108
104
  client.websocket = websocket
109
-
110
- @manager_scheduler.run_in_background(callback_disconnect)
111
105
  end
112
106
 
113
107
  @logger.info "server #{self.server_type}\tstarted on #{host}:#{port}"
data/mrpin-sdk.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'mrpin-sdk'
7
- spec.version = '1.0.67'
7
+ spec.version = '1.0.68'
8
8
  spec.authors = %w(Gregory Tkach Yakupov Dmitrij)
9
9
  spec.email = %w(gregory.tkach@gmail.com yakupov.dmitrij@gmail.com)
10
10
  spec.description = %q{Mrpin sdk for backend development.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrpin-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.67
4
+ version: 1.0.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-05-08 00:00:00.000000000 Z
14
+ date: 2017-05-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler