Skip to content

Commit

Permalink
with
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet committed Jan 26, 2025
1 parent 5fdd09b commit 80eabce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ spec:
# "requestJournal:expiration":"00:01:00",
# "heartbeatThreshold":"0.5",
# }
# name : SLIMFAAS_JOB_CONFIGURATION
# value : | # represent SlimFaas internal configuration, more documentation here:
# {
# "DefaultNumberParallelRequest": 1, # Timeout in seconds
# "DefaultVisibility": "Private", # Retry pattern in seconds
# "AllowDynamicJob": false,
# "Jobs": {
# "daisy" : { "NumberParallelRequest": 1, "Visibility": "Public" }
# }
# }
volumeMounts:
- name: slimfaas-volume
mountPath: /database
Expand Down
12 changes: 6 additions & 6 deletions src/SlimFaas/SlimProxyMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum FunctionType
Wake,
Status,
Publish,
AsyncJob,
Job,
NotAFunction
}

Expand Down Expand Up @@ -47,7 +47,7 @@ public class SlimProxyMiddleware(RequestDelegate next, ISlimFaasQueue slimFaasQu
private const string WakeFunction = "/wake-function";
private const string Function = "/function";
private const string PublishEvent = "/publish-event";
private const string AsyncJob = "/async-job";
private const string Job = "/job";

private readonly int[] _slimFaasPorts = EnvironmentVariables.ReadIntegers(EnvironmentVariables.SlimFaasPorts,
EnvironmentVariables.SlimFaasPortsDefault);
Expand Down Expand Up @@ -91,7 +91,7 @@ await contextResponse.WriteAsJsonAsync(functionStatuses,
case FunctionType.NotAFunction:
await next(context);
return;
case FunctionType.AsyncJob:
case FunctionType.Job:

if (jobService == null)
{
Expand Down Expand Up @@ -568,7 +568,7 @@ private static FunctionInfo GetFunctionInfo(ILogger<SlimProxyMiddleware> faasLog
StatusFunction => FunctionType.Status,
WakeFunction => FunctionType.Wake,
PublishEvent => FunctionType.Publish,
AsyncJob => FunctionType.AsyncJob,
Job => FunctionType.Job,
_ => FunctionType.NotAFunction
};
return new FunctionInfo(functionPath, functionName, functionType);
Expand Down Expand Up @@ -597,9 +597,9 @@ private static string FunctionBeginPath(PathString path)
{
functionBeginPath = $"{PublishEvent}";
}
else if (path.StartsWithSegments(AsyncJob))
else if (path.StartsWithSegments(Job))
{
functionBeginPath = $"{AsyncJob}";
functionBeginPath = $"{Job}";
}

return functionBeginPath;
Expand Down
2 changes: 1 addition & 1 deletion tests/SlimFaas.Tests/SlimProxyMiddlewareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public async Task GetStatusFunctionAndReturnOk(string path, HttpStatusCode expec
}

[Theory]
[InlineData("/async-job/daisy", HttpStatusCode.NoContent, 1)]
[InlineData("/job/daisy", HttpStatusCode.NoContent, 1)]
public async Task RunJobAndReturnOk(string path, HttpStatusCode expectedHttpStatusCode,
int numberFireJob)
{
Expand Down

0 comments on commit 80eabce

Please sign in to comment.