Skip to content

Commit

Permalink
Handling mutex lock/unlock
Browse files Browse the repository at this point in the history
Signed-off-by: Eswar Rajan Subramanian <eswar@accuknox.com>
  • Loading branch information
seswarrajan authored and wazir-ahmed committed Aug 11, 2022
1 parent 7564b94 commit 7d33584
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/observability/cilium.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ func convertFlowLogToCiliumLog(flowLog *flow.Flow) (types.CiliumLog, error) {
func ProcessNetworkLogs() {

if len(NetworkLogs) > 0 {
ObsMutex.Lock()
res := []types.CiliumLog{}

NetworkLogsMutex.Lock()
locNetLogs := NetworkLogs
NetworkLogs = []*flow.Flow{} //reset
NetworkLogsMutex.Unlock()

ObsMutex.Lock()
res := []types.CiliumLog{}

for _, flowLog := range locNetLogs {
netLog, err := convertFlowLogToCiliumLog(flowLog)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions src/observability/kubearmor.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ func convertKubearmorPbLogToKubearmorLog(pbLog pb.Log) types.KubeArmorLog {
func ProcessSystemLogs() {

if len(SystemLogs) > 0 {
ObsMutex.Lock()
res := []types.KubeArmorLog{}

SystemLogsMutex.Lock()
locSysLogs := SystemLogs
SystemLogs = []*pb.Log{} //reset
SystemLogsMutex.Unlock()

ObsMutex.Lock()
res := []types.KubeArmorLog{}

for _, kubearmorLog := range locSysLogs {
locPbLog := pb.Log{}
locLog := types.KubeArmorLog{}
Expand Down

0 comments on commit 7d33584

Please sign in to comment.