Skip to content

Commit

Permalink
[api] Move notification backend calls
Browse files Browse the repository at this point in the history
Moved the Backend::Connection call from UpdateNotificationEvents to
Backend::Api
  • Loading branch information
Moises Deniz Aleman committed Aug 28, 2017
1 parent 2dae904 commit 21263ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/app/models/update_notification_events.rb
Expand Up @@ -55,7 +55,7 @@ def perform
nr = 1 if nr.zero?

begin
@last = Xmlhash.parse(Backend::Connection.get("/lastnotifications?start=#{nr}&block=1").body)
@last = Xmlhash.parse(Backend::Api.last_notifications(nr))
rescue Net::ReadTimeout, EOFError, ActiveXML::Transport::Error
return
end
Expand Down
5 changes: 5 additions & 0 deletions src/api/lib/backend/api.rb
Expand Up @@ -94,5 +94,10 @@ def self.merge_service(project, package, login)
def self.run_service(project, package, login)
Backend::Connection.post("/source/#{CGI.escape(project)}/#{CGI.escape(package)}?cmd=runservice&user=#{CGI.escape(login)}")
end

# Returns the latest notifications specifying a starting point
def self.last_notifications(start)
Backend::Connection.get("/lastnotifications?start=#{CGI.escape(start.to_s)}&block=1").body
end
end
end

0 comments on commit 21263ce

Please sign in to comment.