Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
0ff22c41
Commit
0ff22c41
authored
3 years ago
by
Vikram Ingawale
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Merge branch 'vi_statemdlFixes' into 'devbranch'"
This reverts merge request
!236
parent
3cd5ab1b
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!239
release v1.2.3
,
!237
Revert : Panic issue re-generated with statemdl latest change.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
statemdl/state.go
+1
-1
statemdl/state.go
statemdl/state_fasthttp.go
+1
-3
statemdl/state_fasthttp.go
statemdl/state_gin.go
+1
-3
statemdl/state_gin.go
with
3 additions
and
7 deletions
statemdl/state.go
+
1
−
1
View file @
0ff22c41
...
@@ -95,7 +95,6 @@ var groupMutex = &sync.Mutex{}
...
@@ -95,7 +95,6 @@ var groupMutex = &sync.Mutex{}
var
serverStartTime
time
.
Time
var
serverStartTime
time
.
Time
var
clientResponseData
clientResponse
var
clientResponseData
clientResponse
var
globalClientResponseData
clientResponse
var
initStatus
=
false
var
initStatus
=
false
...
@@ -416,6 +415,7 @@ func collectStatistics() {
...
@@ -416,6 +415,7 @@ func collectStatistics() {
// The following lock guards these two underlying data structures.
// The following lock guards these two underlying data structures.
stateMutex
.
Lock
()
stateMutex
.
Lock
()
defer
stateMutex
.
Unlock
()
defer
stateMutex
.
Unlock
()
ba
,
marshalError
:=
ffjson
.
Marshal
(
clientResponseData
)
ba
,
marshalError
:=
ffjson
.
Marshal
(
clientResponseData
)
if
errormdl
.
CheckErr
(
marshalError
)
!=
nil
{
if
errormdl
.
CheckErr
(
marshalError
)
!=
nil
{
loggermdl
.
LogError
(
marshalError
)
loggermdl
.
LogError
(
marshalError
)
...
...
This diff is collapsed.
Click to expand it.
statemdl/state_fasthttp.go
+
1
−
3
View file @
0ff22c41
...
@@ -13,10 +13,8 @@ import (
...
@@ -13,10 +13,8 @@ import (
func
StateHandler
(
c
*
routing
.
Context
)
error
{
func
StateHandler
(
c
*
routing
.
Context
)
error
{
clientReponseMutex
.
Lock
()
clientReponseMutex
.
Lock
()
defer
clientReponseMutex
.
Unlock
()
defer
clientReponseMutex
.
Unlock
()
// copy `clientResponseData` into `globalClientResponseData` variable bocs we are facing concurrent read/write issue with `clientResponseData`.
globalClientResponseData
=
clientResponseData
c
.
Response
.
Header
.
Set
(
"Access-Control-Allow-Origin"
,
"*"
)
c
.
Response
.
Header
.
Set
(
"Access-Control-Allow-Origin"
,
"*"
)
ba
,
err
:=
json
.
Marshal
(
globalC
lientResponseData
)
ba
,
err
:=
json
.
Marshal
(
c
lientResponseData
)
if
err
!=
nil
{
if
err
!=
nil
{
loggermdl
.
LogError
(
"Failed to marshall statitics - "
,
err
)
loggermdl
.
LogError
(
"Failed to marshall statitics - "
,
err
)
c
.
SetStatusCode
(
417
)
c
.
SetStatusCode
(
417
)
...
...
This diff is collapsed.
Click to expand it.
statemdl/state_gin.go
+
1
−
3
View file @
0ff22c41
...
@@ -10,8 +10,6 @@ import (
...
@@ -10,8 +10,6 @@ import (
func
StateHandler
(
c
*
gin
.
Context
)
{
func
StateHandler
(
c
*
gin
.
Context
)
{
clientReponseMutex
.
Lock
()
clientReponseMutex
.
Lock
()
defer
clientReponseMutex
.
Unlock
()
defer
clientReponseMutex
.
Unlock
()
// copy `clientResponseData` into `globalClientResponseData` variable bocs we are facing concurrent read/write issue with `clientResponseData`.
globalClientResponseData
=
clientResponseData
c
.
Header
(
"Access-Control-Allow-Origin"
,
"*"
)
c
.
Header
(
"Access-Control-Allow-Origin"
,
"*"
)
c
.
JSON
(
200
,
globalC
lientResponseData
)
c
.
JSON
(
200
,
c
lientResponseData
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets