假设我正在用heroku中的以下python代码运行工人import time
time.sleep(60*60)
exit()
heroku ps:restart worker
我想完全停止工作程序,此代码结束程序,但它再次开始具有与ps:scale worker=0
相同的效果我应该在代码中写什么才能具有与heroku {{1}}相同的效果, 这可能吗 ?如果不是,我有什么选择?
答案 0 :(得分:0)
在class CBottomNavBar extends StatefulWidget {
@override
_CBottomNavBarState createState() => _CBottomNavBarState();
}
class _CBottomNavBarState extends State<CBottomNavBar> {
@override
Widget build(BuildContext context) {
return Consumer<SManageIndex>(
builder: (context, manageIndex, child) => Container(
height: 80,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: primaryColorDark,
boxShadow: [
BoxShadow(
color: primaryColorDark, blurRadius: 4, spreadRadius: 2,
// add the offset property
offset: Offset(0, 5), // new line [move to the right[horizontally] by 0 ,move to the top[vertically] by 5]
),
],
borderRadius: BorderRadius.only(
topRight: Radius.circular(20), topLeft: Radius.circular(20))),
child: BottomNavigationBar(
backgroundColor: primaryColorDark,
items: [
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.hospital,
),
title: Text('Appointments')),
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.pills,
),
title: Text('Medicines'),
),
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.bookMedical,
),
title: Text('Documents'),
),
],
currentIndex: manageIndex.index,
onTap: (value) => manageIndex.changePage(value),
),
),
);
}
}
中定义的工作进程应始终在线,与在其中定义的Web进程相同。
对于一次性退出的任务,可以使用one-off worker dyno。您也可以在Heroku scheduler中轻松定义它们。