Skip to content

Commit

Permalink
Merge pull request #319 from tumblr/bhaskar-remove-asyncresult
Browse files Browse the repository at this point in the history
Remove use of async result during asset cancel request
  • Loading branch information
yl3w committed Jun 14, 2015
2 parents 54f2336 + 9c6c014 commit 209c0d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 5 additions & 8 deletions app/collins/controllers/AssetWebApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package collins.controllers
import play.api.libs.json.JsNumber
import play.api.libs.json.JsObject
import play.api.mvc.Action
import play.api.mvc.AsyncResult
import play.api.mvc.Results

import collins.controllers.actions.asset.DeleteAction
Expand All @@ -20,14 +19,13 @@ trait AssetWebApi {
DeleteAction(tag, true, Permissions.AssetWebApi.DeleteAsset, this)

// POST /asset/:tag/cancel
def cancelAsset(tag: String) = Authenticated { user => Action { implicit req =>
def cancelAsset(tag: String) = Authenticated { user =>
if (AppConfig.ignoreAsset(tag)) {
formatResponseData(
Action { implicit req => formatResponseData(
Api.getErrorMessage("Specified asset has been configured to not permit this operation")
)
) }
} else {
val asset = Asset.findByTag(tag)
AsyncResult {
Action.async { implicit req => val asset = Asset.findByTag(tag)
BackgroundProcessor.send(AssetCancelProcessor(tag)) { case(ex,res) =>
val rd: ResponseData = ex.map { err =>
Api.getErrorMessage(err.getMessage)
Expand All @@ -41,8 +39,7 @@ trait AssetWebApi {
}.get
formatResponseData(rd)
}
}
}
}}(Permissions.AssetWebApi.CancelAsset)
}}(Permissions.AssetWebApi.CancelAsset)

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package collins.controllers.actions.asset
import scala.concurrent.Future

import play.api.mvc.SimpleResult
import play.api.mvc.AsyncResult

import collins.controllers.Permissions
import collins.controllers.SecureController
Expand Down

0 comments on commit 209c0d5

Please sign in to comment.