Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: beta branch collapse #67

Open
wants to merge 2,175 commits into
base: master
Choose a base branch
from
Open

WIP: beta branch collapse #67

wants to merge 2,175 commits into from

Conversation

kimburgess
Copy link
Contributor

Merges the 'working copy' of this repo back into master in order to consolidate development ahead of implementation on new simplified branching structure and review process.

Currently awaiting merge of other active changes prior to review.

Copy link
Contributor Author

@kimburgess kimburgess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perf comments on old office lib

data = data.to_json if !data.nil? && data.class != String

if password
headers['Authorization'] = "Bearer #{password_graph_token}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This performs an OAuth token request (possible secondary point of rate limiting) prior to the actual graph request taking place. Caching tokens should help reduce request overhead / number of round trips needed.

if password
headers['Authorization'] = "Bearer #{password_graph_token}"
else
headers['Authorization'] = "Bearer #{graph_token}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here

graph_api = UV::HttpEndpoint.new(@graph_domain, graph_api_options)
response = graph_api.__send__(request_method, path: graph_path, headers: headers, body: data, query: query)

start_timing = Time.now.to_i
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used anywhere (possible left over from some debug logging)?


start_timing = Time.now.to_i
response_value = response.value
end_timing = Time.now.to_i
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here


def check_response(response)
case response.status
when 200, 201, 204
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a range for 200-ish response (e.g. when 200..299) will catch all generally ok responses.

raise Microsoft::Error::ErrorAccessDenied.new(response.body)
when 404
raise Microsoft::Error::ResourceNotFound.new(response.body)
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graph API returns 429's in the case of rate limiting. It's worth handling that explicitly here.

when 404
raise Microsoft::Error::ResourceNotFound.new(response.body)
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other response codes are currently silently swallowed. Worth adding an else condition for these.

endpoint = "/v1.0/users"
request = graph_request(request_method: 'get', endpoint: endpoint, query: query_params, password: @delegated)
check_response(request)
user_list = JSON.parse(request.body)['value']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on response sizes, it may be worth handing this off to a threadpool.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto for all other occurrences of JSON.parse

'$filter': "createdDateTime gt #{created_from}"
}

bulk_response = bulk_graph_request(request_method: 'get', endpoints: endpoints, query: query )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call is synchronous (due to co-routine / awaiting response). This may be intended, but if not, this slicing / loop could be refactored to query each slice in parallel.


event = event.to_json

event.gsub!("X!X!X!",description)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be inserted directly into attributes that need the substitution before stringifying to JSON? Should cut down the amount of string manipulation needed.

w-le and others added 29 commits October 31, 2019 14:31
w-le and others added 30 commits September 23, 2020 13:34
… Ignore power query response (it's always 'false')
chore(pexip) update system_location
Attempt to resolve build error:

```
Bundler could not find compatible versions for gem "ruby":
  In Gemfile:
    ruby

    aca-device-modules was resolved to 2.0.0, which depends on
      ruby (>= 2.3.0)

    aca-device-modules was resolved to 2.0.0, which depends on
      orchestrator was resolved to 2.0.0, which depends on
        rails (~> 6.0) was resolved to 6.1.7.8, which depends on
          ruby (>= 2.5.0)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants