@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Provide a "--local" flag to "bin/conduit call" to force in-process execution

Summary:
See PHI1692. Currently, it's hard to get a local profile or "--trace" of some Diffusion API methods, since they always proxy via HTTP -- even if the local node can serve the request.

This always-proxy behavior is intentional (so we always go down the same code path, to limit surprises) but inconvenient when debugging. Allow an operator to connect to a node which can serve a request and issue a `--local` call to force in-process execution.

This makes it straightforward to "--trace" or "--xprofile" the call.

Test Plan: Ran `bin/conduit call ...` with and without `--local` using a Diffusion method on a clustered repository. Without `--local`, saw proxy via HTTP. With `--local`, saw in-process execution.

Differential Revision: https://secure.phabricator.com/D21114

+17 -3
+17 -3
src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php
··· 22 22 'stdin.'), 23 23 ), 24 24 array( 25 + 'name' => 'local', 26 + 'help' => pht( 27 + 'Force the request to execute in this process, rather than '. 28 + 'proxying to another host in the cluster.'), 29 + ), 30 + array( 25 31 'name' => 'as', 26 32 'param' => 'username', 27 33 'help' => pht( ··· 75 81 76 82 $params = phutil_json_decode($input_json); 77 83 78 - $result = id(new ConduitCall($method, $params)) 79 - ->setUser($actor) 80 - ->execute(); 84 + $call = id(new ConduitCall($method, $params)) 85 + ->setUser($actor); 86 + 87 + $api_request = $call->getAPIRequest(); 88 + 89 + $is_local = $args->getArg('local'); 90 + if ($is_local) { 91 + $api_request->setIsClusterRequest(true); 92 + } 93 + 94 + $result = $call->execute(); 81 95 82 96 $output = array( 83 97 'result' => $result,