Compare commits

...

4 Commits

Author SHA1 Message Date
albaropereyra22
3fa480dd87
Update test.sh appended prefix "X" to string variable comparisons (#1711)
Added the prefix "X" to string variable comparisons because it is the convention mentioned in the book with the turtle. This is done because comparing a variable to a - causes issues.
2023-08-11 12:00:23 +08:00
An Tao
56f620717e
Fix CI in MacOS (#1719) 2023-08-11 00:32:57 +08:00
An Tao
ad99cf724d
Ensure that all filters, AOP advices, and handlers are executed within the IO threads. (#1717) 2023-08-10 23:53:56 +08:00
Ken Matsui
a91014a982
Remove unused Jekyll config (#1714) 2023-08-10 15:24:13 +08:00
6 changed files with 58 additions and 57 deletions

View File

@ -175,7 +175,6 @@ jobs:
if: runner.os == 'macOS'
run: |
cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-services
git reset --hard 5f2fe01
cd ~
brew tap homebrew/services
brew services restart postgresql

View File

@ -1 +0,0 @@
theme: jekyll-theme-cayman

View File

@ -41,37 +41,10 @@ void doAdvicesChain(
callbackPtr,
&advices,
missCallback = std::move(missCallback)]() mutable {
doAdvicesChain(advices,
index + 1,
req,
callbackPtr,
std::move(missCallback));
});
}
else
auto ioLoop = req->getLoop();
if (ioLoop && !ioLoop->isInLoopThread())
{
missCallback();
}
}
void doAdvicesChain(
const std::deque<std::function<void(const HttpRequestPtr &,
AdviceCallback &&,
AdviceChainCallback &&)>> &advices,
size_t index,
const HttpRequestImplPtr &req,
const std::shared_ptr<const std::function<void(const HttpResponsePtr &)>>
&callbackPtr,
std::function<void()> &&missCallback)
{
if (index < advices.size())
{
auto &advice = advices[index];
advice(
req,
[callbackPtr](const HttpResponsePtr &resp) {
(*callbackPtr)(resp);
},
ioLoop->queueInLoop(
[index,
req,
callbackPtr,
@ -83,6 +56,17 @@ void doAdvicesChain(
callbackPtr,
std::move(missCallback));
});
return;
}
else
{
doAdvicesChain(advices,
index + 1,
req,
callbackPtr,
std::move(missCallback));
}
});
}
else
{

View File

@ -47,6 +47,15 @@ static void doFilterChains(
callbackPtr,
&filters,
missCallback = std::move(missCallback)]() mutable {
auto ioLoop = req->getLoop();
if (ioLoop && !ioLoop->isInLoopThread())
{
ioLoop->queueInLoop([index,
req,
callbackPtr,
&filters,
missCallback = std::move(missCallback),
ioLoop]() mutable {
doFilterChains(filters,
index + 1,
req,
@ -55,6 +64,16 @@ static void doFilterChains(
});
}
else
{
doFilterChains(filters,
index + 1,
req,
callbackPtr,
std::move(missCallback));
}
});
}
else
{
missCallback();
}

16
test.sh
View File

@ -4,7 +4,7 @@ echo "First arg:"
echo $1
os='linux'
if [ "$1" = "-w" ]; then
if [ "X$1" = "X-w" ]; then
os='windows'
fi
@ -12,7 +12,7 @@ src_dir=$(pwd)
echo "OS:" $os
if [ $os = "linux" ]; then
if [ "X$os" = "Xlinux" ]; then
drogon_ctl_exec=$(pwd)/build/drogon_ctl/drogon_ctl
else
drogon_ctl_exec=$(pwd)/build/drogon_ctl/Debug/drogon_ctl.exe
@ -21,7 +21,7 @@ fi
echo ${drogon_ctl_exec}
cd build/lib/tests/
if [ $os = "windows" ]; then
if [ "X$os" = "Xwindows" ]; then
cd Debug
fi
@ -42,7 +42,7 @@ case $(nproc) in
;;
esac
if [ $os = "linux" ]; then
if [ "X$os" = "Xlinux" ]; then
if [ -f /bin/ninja ]; then
cmake_gen='-G Ninja'
else
@ -51,7 +51,7 @@ if [ $os = "linux" ]; then
fi
#Make integration_test_server run as a daemon
if [ $os = "linux" ]; then
if [ "X$os" = "Xlinux" ]; then
sed -i -e "s/\"run_as_daemon.*$/\"run_as_daemon\": true\,/" config.example.json
fi
sed -i -e "s/\"relaunch_on_error.*$/\"relaunch_on_error\": true\,/" config.example.json
@ -131,7 +131,7 @@ cd ../views
echo "Hello, world!" >>hello.csp
cd ../build
if [ $os = "windows" ]; then
if [ "X$os" = "Xwindows" ]; then
cmake_gen="$cmake_gen -DCMAKE_TOOLCHAIN_FILE=$src_dir/conan_toolchain.cmake \
-DCMAKE_PREFIX_PATH=$src_dir/install \
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW \
@ -151,7 +151,7 @@ if [ $? -ne 0 ]; then
exit -1
fi
if [ $os = "linux" ]; then
if [ "X$os" = "Xlinux" ]; then
if [ ! -f "drogon_test" ]; then
echo "Failed to build drogon_test"
exit -1
@ -166,7 +166,7 @@ fi
cd ../../
rm -rf drogon_test
if [ "$1" = "-t" ]; then
if [ "X$1" = "X-t" ]; then
#unit testing
cd ../../
echo "Unit testing"

@ -1 +1 @@
Subproject commit 85a2a212102718fe3973b2ae183c75afdffc83a3
Subproject commit e50b4162de48717a569ccd5c6f31c1e9a9b6374b