背景工作者(Background worker)
如果我有一组操作,我想根据特定条件在后台工作程序中运行,例如,我有10个条件
if(a) BackgroundWorker doA = new backgroundworker() if(b) BackgroundWorker doB = new backgroundworker() if(c) BackgroundWorker doC = new backgroundworker() if(d) BackgroundWorker doD = new backgroundworker() ... ...
每个后台工作人员都需要一个dowork,runworkercompleted等....无论如何都要避免这样做,因此它会使代码变得不那么混乱/污染,因为其中一些方法可能会很大?
谢谢
If i have a set of actions i want to run in a background worker based on a certain condition and i have 10 conditions, for example
if(a) BackgroundWorker doA = new backgroundworker() if(b) BackgroundWorker doB = new backgroundworker() if(c) BackgroundWorker doC = new backgroundworker() if(d) BackgroundWorker doD = new backgroundworker() ... ...
each of those background workers will require a dowork, runworkercompleted etc.... is there anyway to avoid that so it makes the code less messy/clutered as some of those methods might be quite big?
thanks
原文:https://stackoverflow.com/questions/5538372
最满意答案
您是否尝试将
node_modules
添加到.gitignore
文件并检查gitignore
文件?我假设Heroku抱怨,因为它试图安装
node_modules
但它已经在同一位置看到名为node_modules
的文件夹。Did you try adding
node_modules
to your.gitignore
file and checking in thegitignore
file?I am assuming Heroku is complaining because it's trying to install the
node_modules
but it already sees a folder callednode_modules
in the same location.
相关问答
更多-
Heroku - Express App - 错误:产生指南针ENOENT(Heroku - Express App - Error: spawn compass ENOENT)[2021-06-26]
经过大量的故障排除后,我终于找到了它的底部。 heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git 在根目录中创建一个名为.buildpacks的文件,并添加以下https://github.com/heroku/heroku-buildpack-nodejs.git https://github.com/heroku/heroku-buildpack-ruby.git 在根目录中创建一个名 ... -
流星产卵错误ENOENT(Meteor Spawn Error ENOENT)[2019-07-09]
我的解决方案是在服务器上从头开始安装流程,如果它不存在.... My solution was to install the process from scratch on the server if it didn't exist.... -
这里是解析Gemfile的错误:语法错误,意外的':',期待输入结束 - 组:生产 如上面的日志...这只是语法错误 group: production do gem 'pg' gem 'rails_12factor' end 从它更新 group :production do gem 'pg' gem 'rails_12factor' end here was an error parsing Gemfile: syntax error, unexpected ':', expecti ...
-
在Mac OS X上npm ENOENT错误 - 没有这样的文件或目录(npm ENOENT error on mac OS X - no such file or directory)[2022-05-21]
我认为这是一个在root帐户下运行npm的问题,这是不鼓励的。 为了在没有sudo标志的情况下运行所有的计算机npm,可以为nvm安装nvm 。 它允许您拥有许多节点版本,并且可以在不使用root帐户(sudo命令)的情况下安装 - --global软件包。 你可以安装他们的官方脚本来安装它: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash nvm回购: https : //github. ... -
您是否尝试将node_modules添加到.gitignore文件并检查gitignore文件? 我假设Heroku抱怨,因为它试图安装node_modules但它已经在同一位置看到名为node_modules的文件夹。 Did you try adding node_modules to your .gitignore file and checking in the gitignore file? I am assuming Heroku is complaining because it's tryi ...
-
将React Starter Kit(由Kriasoft)部署到Heroku(Deploy React Starter Kit (by Kriasoft) to Heroku)[2021-05-30]
似乎反应入门工具包默认情况下不会作为生产运行,并且buildpack 将环境设置为生产环境 。 我相信你可以在项目中添加一个Procfile ,告诉它作为生产开始,或者只是将Heroku环境设置为开发 。 如果您在错误时发布Heroku日志,我们可以看到它的更多细节。 It seems that the react starter kit doesn't run as production by default, and the buildpack sets the environment to produ ... -
你应该删除gemfile开发组之外的行gem 'sqlite3', '1.3.8' 。 并移动开发组中的sqlite3引用以包括测试组: group :development, :test do gem 'sqlite3', '1.3.8' end 问题是heroku使用PostgreSQL,当你部署时,它试图使用sqlite3 gem,因为它在开发组之外以及在其中。 You should remove the line gem 'sqlite3', '1.3.8' that is outside t ...
-
heroku Errno :: ENOENT(没有这样的文件或目录 - / assets /)(heroku Errno::ENOENT (No such file or directory - /assets/))[2023-01-24]
你在使用premailer-rails3 gem吗? 我发现版本1.2.0导致了同样的问题。 降级至1.1.0修正了它。 希望有所帮助! Are you using the premailer-rails3 gem? I found that version 1.2.0 caused this exact same problem. Downgrading to 1.1.0 fixed it. Hope that helps! -
这里的问题是你使模型类成为可注射的 。 @Injectable() export class RatingModel { 你不必将模型类设为可注射的。 如果您确实需要这样做,则必须将其设置为提供者。 或者尝试从显式注入器中获取对象。 constructor(private injector: Injector) { } //.. this.ratingModel = this.injector.get(RatingModel) The problem here is you are making ...
-
你的项目中只有错误的路径。 在Heroku上,您无法写入项目根目录下的文件夹。 在您的情况下,您的代码在app.js运行,该app.js位于项目的“root”文件夹中。 因此,在Heroku的文件系统上,这意味着您的项目如下所示: /app /app/app.js /app/public /app/public/images ... Heroku将您的所有代码放入名为app的文件夹中。 现在,在上面粘贴的代码中,您显示: Request(uri).pipe(fs.createWriteStream(__d ...