This repository was archived by the owner on Feb 7, 2024. It is now read-only.
File tree 2 files changed +29
-7
lines changed
2 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ public function save()
103
103
continue ;
104
104
}
105
105
106
- $ this ->driver :: create ($ statistic-> toArray () );
106
+ $ this ->createRecord ($ statistic );
107
107
108
108
$ currentConnectionCount = $ this ->channelManager ->getConnectionCount ($ appId );
109
109
@@ -135,4 +135,15 @@ public function getStatistics(): array
135
135
{
136
136
return $ this ->statistics ;
137
137
}
138
+
139
+ /**
140
+ * Create a new record using the Statistic Driver.
141
+ *
142
+ * @param Statistic $statistic
143
+ * @return void
144
+ */
145
+ public function createRecord (Statistic $ statistic )
146
+ {
147
+ $ this ->driver ::create ($ statistic ->toArray ());
148
+ }
138
149
}
Original file line number Diff line number Diff line change @@ -122,12 +122,7 @@ public function save()
122
122
continue ;
123
123
}
124
124
125
- $ this ->driver ::create ([
126
- 'app_id ' => $ appId ,
127
- 'peak_connection_count ' => $ statistic ['peak_connection_count ' ] ?? 0 ,
128
- 'websocket_message_count ' => $ statistic ['websocket_message_count ' ] ?? 0 ,
129
- 'api_message_count ' => $ statistic ['api_message_count ' ] ?? 0 ,
130
- ]);
125
+ $ this ->createRecord ($ statistic );
131
126
132
127
$ currentConnectionCount = $ this ->channelManager ->getConnectionCount ($ appId );
133
128
@@ -203,4 +198,20 @@ protected function lock()
203
198
{
204
199
return new RedisLock ($ this ->redis , 'laravel-websockets:lock ' , 0 );
205
200
}
201
+
202
+ /**
203
+ * Create a new record using the Statistic Driver.
204
+ *
205
+ * @param array $statistic
206
+ * @return void
207
+ */
208
+ protected function createRecord (array $ statistic ): void
209
+ {
210
+ $ this ->driver ::create ([
211
+ 'app_id ' => $ appId ,
212
+ 'peak_connection_count ' => $ statistic ['peak_connection_count ' ] ?? 0 ,
213
+ 'websocket_message_count ' => $ statistic ['websocket_message_count ' ] ?? 0 ,
214
+ 'api_message_count ' => $ statistic ['api_message_count ' ] ?? 0 ,
215
+ ]);
216
+ }
206
217
}
You can’t perform that action at this time.
0 commit comments