Skip to content

Commit

Permalink
[backend] Fix resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelHassine committed Oct 23, 2023
1 parent bcdee54 commit a855f30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
3 changes: 0 additions & 3 deletions opencti-platform/opencti-graphql/src/database/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -1985,14 +1985,11 @@ export const updateAttribute = async (context, user, id, type, inputs, opts = {}
if (relType === RELATION_GRANTED_TO && !isUserHasCapability(user, KNOWLEDGE_ORGANIZATION_RESTRICT)) {
throw ForbiddenAccess();
}

let { value: refs, operation = UPDATE_OPERATION_REPLACE } = meta[metaIndex];

if (relType === RELATION_OBJECT_MARKING) {
const markingsCleaned = await handleMarkingOperations(context, initial.objectMarking, refs, operation);
({ operation, refs } = { operation: markingsCleaned.operation, refs: markingsCleaned.refs });
}

if (operation === UPDATE_OPERATION_REPLACE) {
// Delete all relations
const currentRels = await listAllRelations(context, user, relType, { fromId: id });
Expand Down
17 changes: 9 additions & 8 deletions opencti-worker/src/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,24 +274,24 @@ def data_handler( # pylint: disable=too-many-statements, too-many-locals
else:
# Unknown type, just move on.
return True
except Timeout:
error_msg = traceback.format_exc()
except Timeout as ex:
error = str(ex)
bundles_timeout_error_counter.add(1)
self.api.log(
"warning", "A connection timeout occurred: {{ " + error_msg + " }}"
"warning", "A connection timeout occurred: {{ " + error + " }}"
)
time.sleep(30)
# Platform is under heavy load: wait for unlock & retry almost indefinitely.
sleep_jitter = round(random.uniform(10, 30), 2)
time.sleep(sleep_jitter)
self.data_handler(connection, channel, delivery_tag, data)
return True
except RequestException:
error_msg = traceback.format_exc()
except RequestException as ex:
error = str(ex)
bundles_request_error_counter.add(1, {"origin": "opencti-worker"})
self.api.log(
"error", "A connection error occurred: {{ " + error_msg + " }}"
"error", "A connection error occurred: {{ " + error + " }}"
)
time.sleep(60)
self.api.log(
"info",
"Message (delivery_tag="
Expand Down Expand Up @@ -348,11 +348,12 @@ def data_handler( # pylint: disable=too-many-statements, too-many-locals
},
)
return False
elif "ConnectionError" in error_msg:
elif "Bad Gateway" in error_msg:
bundles_bad_gateway_error_counter.add(1)
self.api.log(
"error", "A connection error occurred: {{ " + error + " }}"
)
time.sleep(30)
self.api.log(
"info",
"Message (delivery_tag="
Expand Down

0 comments on commit a855f30

Please sign in to comment.